forked from Axle-Ozz-i-sofT/Nuklear-Visual-Style-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nk_theme.c
5980 lines (5385 loc) · 319 KB
/
nk_theme.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//------------------------------------------------------------------------------
// Name: Nuklear Visual Style Editor (nk_theme.c)
// URL:
// Purpose: Visually create formatted Nuklear style tables
// Load and save formatted nk table file.
// [start_nk_style_v1] - [end_nk_style_v1]
//
// Platform: Win64 W8.1+, Ubuntu64 20.04+
//
// Author: Axle
// Created: 27/02/2024
// Updated: 04/03/2024
// Copyright: (c) Axle 2024
// Licence: MIT0 No Attribution
//------------------------------------------------------------------------------
// NOTES:
// Windows x86-64
// IDE: Dev-C++,
// STD ISO C99
// winlibs-x86_64-posix-seh-gcc-13.2.0-mingw-w64msvcrt-11.0.1-r5
//
// Nuklear V4.12.0
// https://github.com/Immediate-Mode-UI/Nuklear/releases/tag/4.12.0
// "Nuklear-4.12.0.zip" "Nuklear-4.12.0.tar.gz"
// Allegro Version 5.2.9.1 Dynamic linking
// https://github.com/liballeg/allegro5/releases
// allegro-x86_64-w64-mingw32-gcc-13.2.0-posix-seh-dynamic-5.2.9.0.zip
// https://github.com/liballeg/allegro_wiki/wiki/Quickstart
//
// Dynamic linking: Under Linking options enter `-lallegro'
// You will need to link other library components as well when required.
// -lallegro-5.2
// -lallegro_image-5.2
// -lallegro_font-5.2
// -lallegro_ttf-5.2
// -lallegro_primitives-5.2
// -lallegro_dialog-5.2
// -lm
// Ubuntu x86-64
// Version: 2:5.2.9.1-1~focal
// liballegro5-dev
// https://github.com/liballeg/allegro_wiki/wiki/Quickstart
// sudo add-apt-repository ppa:allegro/5.2
// sudo apt-get install liballegro*5.2 liballegro*5-dev
// sudo apt-get install liballegro-ttf5-dev
// Redist:
// liballegro5.2
// wget -c http://ppa.launchpad.net/allegro/5.2/ubuntu/pool/main/a/allegro5/liballegro5.2_5.2.9.1-1~focal_amd64.deb
// Linker (Code::Blocks)
// allegro-5.2
// allegro_image-5.2
// allegro_font-5.2
// allegro_ttf-5.2
// allegro_primitives-5.2
// allegro_dialog-5.2
//
// allegro depends:
//libgcc_s_seh-1.dll
//libstdc++-6.dll
//libwinpthread-1.dll
//
// You will need to copy the above Allegro and MinGW rutimes as well As the
// resource files to your bin output directory.
//------------------------------------------------------------------------------
// TODO:
// Get system theme colors (Pro)
// Load save multiple styles style.c (Pro)
//------------------------------------------------------------------------------
static int
nk_theme(struct nk_context *ctx,
ALLEGRO_DISPLAY *display,
struct nk_color table[3][NK_COLOR_COUNT],
struct nk_image *logo,
int *img_select,
struct nk_color nk_bk_color[3],
NkAllegro5Font *font,
NkAllegro5Font *font_l,
int *alpha_flag,
int *alpha_all,
int *quit_app)
{
// Test examples
/* window flags */
static nk_bool show_menu = nk_true; // overview.c
static nk_bool about_dialog = nk_false; // overview.c
/* popups */
static enum nk_style_header_align header_align = NK_HEADER_RIGHT;
// ???
ctx->style.window.header.align = header_align;
// Application flags
static nk_bool show_menu1 = nk_true;
static nk_bool show_hr = nk_true;
static nk_bool show_title = nk_true;
static nk_bool show_app_about = nk_false; // overview.c
static nk_bool help_dialog = nk_false;
static nk_bool popup_button = nk_false; // nk_bool!!!!
static nk_bool theme_apply = nk_false; // Apply theme to main application
static nk_bool resetall = nk_false; // Revert to original color style.
static int reset_nk_color = -1; // Reset single original color style.
static nk_bool clear_change = nk_false; // Clear current color adjustment.
// enable background image
enum {IMG_0, IMG_1, IMG_2};
static int bg_img_op = IMG_0;
// Enable alpha sliders lock
// There is somethink wrong with this initialisation being inside of the function!!!
enum alpha_op {NONE, ALL};
static int alpha_op = NONE; // Always reset to NONE every frame?
//static int alpha_all = 255; // Always reset to 255 every frame?
static nk_bool bg_theme_apply = nk_false; // Apply background color to main application
static nk_bool bg_resetall = nk_false; // Revert to original background color style.
static nk_bool bg_reset_nk_color = nk_false; // Reset single original background color style.
static nk_bool bg_clear_change = nk_false; // Clear current background color adjustment.
static nk_bool disable_widgets = nk_false; // Examples overview.c
// User save file check befor exiting.
static nk_bool exit_check = nk_false; // Check popup.
static nk_bool quit = nk_false; // confirmed quit.
/* File select dialogs */
ALLEGRO_FILECHOOSER *file_path = NULL; // Selected file path (Load/Save).
static nk_bool file_ret = nk_false; // Test if file selected.
// NOTE: Allegro native file dialogs stalls the NK widgets. I am allowing
// 4 passes before opening the native file dialogs to allow menus to close.
// I am not sure what is causing this behaviour at the moment.
static int file_load = 0; // Flag to do file load tasks.
static int file_save = 0; // Flag to do file load tasks.
// File load/read errors.
static int file_read_err = 0;
static const char fr_err_list[7][64] =
{
{"NULL"}, // 0
{"File not selected!"}, // 1
{"Error opening file!"}, // 2
{"Error! Header not found or incorrect length!"}, // 3
{"Error! Footer not found or incorrect length!"}, // 4
{"Error! File too long!"}, // 5
{"Error! File too short!"}, // 6
};
// Application window
//static nk_flags window_flags = NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_SCALABLE|NK_WINDOW_MOVABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_CLOSABLE;
//nk_flags actual_window_flags;
static nk_flags window_flags = NK_WINDOW_BORDER;
// Get the current Allegro window dimensions for auto resizing.
// This is checked every main loop and resize applied.
// WINDOW_WIDTH, WINDOW_HEIGHT = nk_begin (Window)
int AL_WINDOW_W = al_get_display_width(display);
int AL_WINDOW_H = al_get_display_height(display);
// ###-> Start main Nuklear window (full size to Allegro window) ###
if (nk_begin(ctx, "NK_Theme", nk_rect(0, 0, AL_WINDOW_W, AL_WINDOW_H), window_flags))
{
// ###-> START MAIN MENU ###
if (show_menu1)
{
/* menubar */
nk_menubar_begin(ctx);
nk_layout_row_begin(ctx, NK_STATIC, 30, 2); // Row H px, and number rows.
/* menu #1 */
nk_layout_row_push(ctx, 50);
if (nk_menu_begin_label(ctx, "FILE", NK_TEXT_LEFT, nk_vec2(200, 600)))
{
nk_layout_row_dynamic(ctx, 25, 1);
if (nk_menu_item_label(ctx, "Open", NK_TEXT_LEFT))
{
file_load = 5; // Needs minimum 3 loops or UI stops responding?
// Native file dialogs moved to if (file_load){}
}
if (nk_menu_item_label(ctx, "Save", NK_TEXT_LEFT))
{
file_save = 5;
// Native file dialogs moved to if (file_save){}
}
if (nk_menu_item_label(ctx, "Exit", NK_TEXT_LEFT))
{
// Do exit tasks
exit_check = nk_true;
}
nk_menu_end(ctx);
}
/* Menu #2 */
// Future implementation. Alow copy paste of RGB colors.
/*
nk_layout_row_push(ctx, 50);
if (nk_menu_begin_label(ctx, "EDIT", NK_TEXT_LEFT, nk_vec2(200, 600)))
{
nk_layout_row_dynamic(ctx, 25, 1);
if (nk_menu_item_label(ctx, "Copy", NK_TEXT_LEFT))
{
// Do_new_task = nk_true;
fprintf(stdout, "EDIT -> Copy not used.\n"); // DEBUG
}
if (nk_menu_item_label(ctx, "Paste", NK_TEXT_LEFT))
{
// Do_new_task = nk_true;
fprintf(stdout, "EDIT -> Paste not used.\n"); // DEBUG
}
nk_menu_end(ctx);
}
*/
/* menu #3 */
nk_layout_row_push(ctx, 50);
if (nk_menu_begin_label(ctx, "VIEW", NK_TEXT_LEFT, nk_vec2(200, 600)))
{
nk_layout_row_dynamic(ctx, 25, 1);
if (nk_menu_item_label(ctx, "Help", NK_TEXT_LEFT))
{
help_dialog = nk_true;
}
// Future implementation
/*if (nk_menu_item_label(ctx, "Options", NK_TEXT_LEFT))
{
// Do_new_task = nk_true;
fprintf(stdout, "VIEW -> Options not used.\n"); // DEBUG
}*/
if (nk_menu_item_label(ctx, "About", NK_TEXT_LEFT))
{
about_dialog = nk_true;
}
nk_menu_end(ctx);
}
nk_menubar_end(ctx);
} // ### END MAIN MENU <-###
// Horizontal rule/line
if (show_hr)
{
// Will create a horizontal line/divider. I need to get the default border color.
nk_layout_row_dynamic(ctx, 2, 1);
// The last argument is for rounding of the box true|false
//nk_rule_horizontal(ctx, table[2][NK_COLOR_BORDER], nk_false);
nk_rule_horizontal(ctx, ctx->style.window.border_color, nk_false);
}
bool cancel_ops = false; // ### This needs to be moved out of the function!
// See Allegro File I/O Native file dialogs
if (file_load > 0)
{
//al_rest(0.5); // wait must be given or 5 loops
if (file_load < 2)
{
// Remember that Win and Unix have different paths.
file_path = al_create_native_file_dialog(PATH_STYLES,"Choose a file [.txt|.h|.c]...", "*.txt;*.c;*.h", ALLEGRO_FILECHOOSER_FILE_MUST_EXIST);
file_ret = al_show_native_file_dialog(display, file_path);
if (file_ret) // Rename this
{
// Do file open taks...
FILE *FileIn;// File open handle
// ### Rename these buffers
// String buffer length is enforced by fgets()
char tok_temp_buffer[128] = {'\0'};// Temp buffer for string manipulations
char string_temp_buffer[128] = {'\0'};//
FileIn = fopen(al_get_native_file_dialog_path(file_path, 0), "r");// Open file for read ops text.
if(FileIn == NULL)// Test if file open success.
{
file_read_err = 2;
cancel_ops = true;
}
if (!cancel_ops)
{
int cnt_rows = 0;// track array row position
int count_colors = 0;
while(fgets(string_temp_buffer, 128, FileIn) != NULL)
{
// Walk each line from the file (returns ',' in the string
// with '\n' at the end).
// Strip the newline character from the line.
// Replace newline char '\n' with '\0'
string_temp_buffer[strcspn(string_temp_buffer, "\r\n")] = '\0';
// Test if style header is correct.
// If not cancel operation.
if (cnt_rows == 0)
{
if ((!strstr(string_temp_buffer, "[start_nk_style_v1]")) || (strlen(string_temp_buffer) > 19))
{
file_read_err = 3;
cancel_ops = true;
break;
}
}
// Test if style footer is correct.
// If not cancel operation.
if (cnt_rows == 29)
{
if ((!strstr(string_temp_buffer, "[end_nk_style_v1]")) || (strlen(string_temp_buffer) > 17))
{
file_read_err = 4;
cancel_ops = true;
break;
}
}
// Capture string (r, g, b, a) from string row.
int count_token = 0;
char tok_temp_buffer2[32] = {'\0'}; // should be no more than 18 chars
if ((cnt_rows > 0) && (cnt_rows < 29))
{
// Token split string at '(' and ')'
char* token1 = strtok(string_temp_buffer, "()");
while( token1 != NULL )
{
// We are keeping the second token "r, g, b, a"
if (count_token == 1)
{
strncpy(tok_temp_buffer, token1, 32);
}
token1 = strtok(NULL, "()");
count_token++; // Increment the array position for next column (next token)
}
// Remove any space ' ' characters.
// "r, g, b, a" to "r,g,b,a"
char c;
int i = 0;
int k = 0;
do
{
c = tok_temp_buffer[i];
if ((c != ' ') && (c != '\0'))
{
tok_temp_buffer2[k] = c;
k++;
tok_temp_buffer2[k] = '\0';
}
i++;
}
while (c != '\0'); // End of string
// set up a temporary rgba array and structure.
char str_color[4][8] = {'\0'};
// Break the rgba string numerics out from the ',' delimiter.
char* token2 = strtok(tok_temp_buffer2, ",");
int str_col_cnt = 0;
while( token2 != NULL )
{
strncat(str_color[str_col_cnt], token2, 8);
token2 = strtok(NULL, ",");
str_col_cnt++;
}
// Convert string numeric to int and populate nk_color structure for NK_COLOR_COUNT
char *ptr;
// struct nk_color table[3][NK_COLOR_COUNT]
for (int r = 0; r < 3; r++)
{
table[r][count_colors].r = strtol(str_color[0], &ptr, 10);
table[r][count_colors].g = strtol(str_color[1], &ptr, 10);
table[r][count_colors].b = strtol(str_color[2], &ptr, 10);
table[r][count_colors].a = strtol(str_color[3], &ptr, 10);
}
count_colors++; // Increment table2[0 - 27] aka NK_COLOR_COUNT
} // End RGBA rows
cnt_rows++; // move to next line/row and repeat.
// If too many rows in file cancel file read operations.
if (cnt_rows > 30)
{
file_read_err = 5;
cancel_ops = true;
fclose( FileIn );
break;
}
} // END while read lines as string
// If too few rows in file cancel operation
if (!cancel_ops)
{
if (cnt_rows < 30)
{
file_read_err = 6;
cancel_ops = true;
}
}
//theme_apply = nk_true;
nk_style_from_table(ctx, table[0]);
fclose( FileIn );// finished file reads, close the file.
//fprintf(stdout, "Close File - True!\n"); // DEBUG
} // END if (!cancel_ops)
} // END al_show_native_file_dialog == true
else
{
file_read_err = 1;
cancel_ops = true;
}
al_destroy_native_file_dialog(file_path); // Check if this is in the correct location??
file_load = 0; // Check this is getting passed on error?
}
else
{
file_load--; // Work around for stalled NK wingets.
}
cancel_ops = false;
} // END (file_load)
// See Allegro File I/O Native file dialogs.
if (file_save > 0)
{
//al_rest(0.5); // wait must be given or 5 loops
if (file_save < 2)
{
// Remember that Win and Unix have different paths.
file_path = al_create_native_file_dialog(PATH_STYLES,"Choose a save file [.txt|.h|.c]...", "*.txt", ALLEGRO_FILECHOOSER_SAVE);
file_ret = al_show_native_file_dialog(display, file_path);
if (file_ret)
{
// table[0] == current edit
// table[2] == applied/undo (Use this)
// Do file save tasks...
FILE *FileOut;// File open handle
// NOTE! Overwrites the file contents.
FileOut = fopen(al_get_native_file_dialog_path(file_path, 0), "w"); // Open file for write ops text.
if(FileOut == NULL)// Test if file open success.
{
file_read_err = 2;
cancel_ops = true;
}
if (!cancel_ops)
{
// Do File Write ops.
// See enum nk_style_colors 0 - 28
// ### Fix this? Loop through 28 lines with NK_COLOR_xxx from an array.
fprintf(FileOut, "[start_nk_style_v1]\n");
fprintf(FileOut, "table[NK_COLOR_TEXT] = nk_rgba(%d, %d, %d, %d)\n", table[2][0].r, table[2][0].g, table[2][0].b, table[2][0].a);
fprintf(FileOut, "table[NK_COLOR_WINDOW] = nk_rgba(%d, %d, %d, %d)\n", table[2][1].r, table[2][1].g, table[2][1].b, table[2][1].a);
fprintf(FileOut, "table[NK_COLOR_HEADER] = nk_rgba(%d, %d, %d, %d)\n", table[2][2].r, table[2][2].g, table[2][2].b, table[2][2].a);
fprintf(FileOut, "table[NK_COLOR_BORDER] = nk_rgba(%d, %d, %d, %d)\n", table[2][3].r, table[2][3].g, table[2][3].b, table[2][3].a);
fprintf(FileOut, "table[NK_COLOR_BUTTON] = nk_rgba(%d, %d, %d, %d)\n", table[2][4].r, table[2][4].g, table[2][4].b, table[2][4].a);
fprintf(FileOut, "table[NK_COLOR_BUTTON_HOVER] = nk_rgba(%d, %d, %d, %d)\n", table[2][5].r, table[2][5].g, table[2][5].b, table[2][5].a);
fprintf(FileOut, "table[NK_COLOR_BUTTON_ACTIVE] = nk_rgba(%d, %d, %d, %d)\n", table[2][6].r, table[2][6].g, table[2][6].b, table[2][6].a);
fprintf(FileOut, "table[NK_COLOR_TOGGLE] = nk_rgba(%d, %d, %d, %d)\n", table[2][7].r, table[2][7].g, table[2][7].b, table[2][7].a);
fprintf(FileOut, "table[NK_COLOR_TOGGLE_HOVER] = nk_rgba(%d, %d, %d, %d)\n", table[2][8].r, table[2][8].g, table[2][8].b, table[2][8].a);
fprintf(FileOut, "table[NK_COLOR_TOGGLE_CURSOR] = nk_rgba(%d, %d, %d, %d)\n", table[2][9].r, table[2][9].g, table[2][9].b, table[2][9].a);
fprintf(FileOut, "table[NK_COLOR_SELECT] = nk_rgba(%d, %d, %d, %d)\n", table[2][10].r, table[2][10].g, table[2][10].b, table[2][10].a);
fprintf(FileOut, "table[NK_COLOR_SELECT_ACTIVE] = nk_rgba(%d, %d, %d, %d)\n", table[2][11].r, table[2][11].g, table[2][11].b, table[2][11].a);
fprintf(FileOut, "table[NK_COLOR_SLIDER] = nk_rgba(%d, %d, %d, %d)\n", table[2][12].r, table[2][12].g, table[2][12].b, table[2][12].a);
fprintf(FileOut, "table[NK_COLOR_SLIDER_CURSOR] = nk_rgba(%d, %d, %d, %d)\n", table[2][13].r, table[2][13].g, table[2][13].b, table[2][13].a);
fprintf(FileOut, "table[NK_COLOR_SLIDER_CURSOR_HOVER] = nk_rgba(%d, %d, %d, %d)\n", table[2][14].r, table[2][14].g, table[2][14].b, table[2][14].a);
fprintf(FileOut, "table[NK_COLOR_SLIDER_CURSOR_ACTIVE] = nk_rgba(%d, %d, %d, %d)\n", table[2][15].r, table[2][15].g, table[2][15].b, table[2][15].a);
fprintf(FileOut, "table[NK_COLOR_PROPERTY] = nk_rgba(%d, %d, %d, %d)\n", table[2][16].r, table[2][16].g, table[2][16].b, table[2][16].a);
fprintf(FileOut, "table[NK_COLOR_EDIT] = nk_rgba(%d, %d, %d, %d)\n", table[2][17].r, table[2][17].g, table[2][17].b, table[2][17].a);
fprintf(FileOut, "table[NK_COLOR_EDIT_CURSOR] = nk_rgba(%d, %d, %d, %d)\n", table[2][18].r, table[2][18].g, table[2][18].b, table[2][18].a);
fprintf(FileOut, "table[NK_COLOR_COMBO] = nk_rgba(%d, %d, %d, %d)\n", table[2][19].r, table[2][19].g, table[2][19].b, table[2][19].a);
fprintf(FileOut, "table[NK_COLOR_CHART] = nk_rgba(%d, %d, %d, %d)\n", table[2][20].r, table[2][20].g, table[2][20].b, table[2][20].a);
fprintf(FileOut, "table[NK_COLOR_CHART_COLOR] = nk_rgba(%d, %d, %d, %d)\n", table[2][21].r, table[2][21].g, table[2][21].b, table[2][21].a);
fprintf(FileOut, "table[NK_COLOR_CHART_COLOR_HIGHLIGHT] = nk_rgba(%d, %d, %d, %d)\n", table[2][22].r, table[2][22].g, table[2][22].b, table[2][22].a);
fprintf(FileOut, "table[NK_COLOR_SCROLLBAR] = nk_rgba(%d, %d, %d, %d)\n", table[2][23].r, table[2][23].g, table[2][23].b, table[2][23].a);
fprintf(FileOut, "table[NK_COLOR_SCROLLBAR_CURSOR] = nk_rgba(%d, %d, %d, %d)\n", table[2][24].r, table[2][24].g, table[2][24].b, table[2][24].a);
fprintf(FileOut, "table[NK_COLOR_SCROLLBAR_CURSOR_HOVER] = nk_rgba(%d, %d, %d, %d)\n", table[2][25].r, table[2][25].g, table[2][25].b, table[2][25].a);
fprintf(FileOut, "table[NK_COLOR_SCROLLBAR_CURSOR_ACTIVE] = nk_rgba(%d, %d, %d, %d)\n", table[2][26].r, table[2][26].g, table[2][26].b, table[2][26].a);
fprintf(FileOut, "table[NK_COLOR_TAB_HEADER] = nk_rgba(%d, %d, %d, %d)\n", table[2][27].r, table[2][27].g, table[2][27].b, table[2][27].a);
fprintf(FileOut, "[end_nk_style_v1]\n");
fclose( FileOut );// finished file reads, close the file.
} // END if (!cancel_ops)
} // END al_show_native_file_dialog
else
{
file_read_err = 1;
cancel_ops = true;
}
al_destroy_native_file_dialog(file_path); // Check if this is in the correct location??
file_save = 0;
} // END file_ret
else
{
file_save--; // Work around for stalled NK widgets.
}
cancel_ops = false;
}
// Do file read/write errors.
if (file_read_err > 0)
{
// Do NK file dialog
int about_w = 300 ;
int about_h = 110;
int about_x = (AL_WINDOW_W / 2) - (about_w/2);
int about_y = (AL_WINDOW_H / 2) - (about_h/2);
struct nk_rect error_rect = {about_x, about_y, about_w, about_h};
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "File Error", NK_WINDOW_TITLE|NK_WINDOW_CLOSABLE|NK_WINDOW_BORDER, error_rect))
{
nk_layout_row_dynamic(ctx, 20, 1);
nk_label(ctx, "", NK_TEXT_LEFT); // Separator
// Consider nk_label_color
nk_label(ctx, fr_err_list[file_read_err], NK_TEXT_CENTERED);
nk_popup_end(ctx);
}
else
{
file_read_err = 0;
cancel_ops = false; // Should be redundant
}
}
// Help message.
if (help_dialog)
{
// Center dialog box on screen.
// TODO: Clean this up.
int help_w = 500;
int help_h = 400;
int help_x = (AL_WINDOW_W / 2) - (help_w/2);
int help_y = (AL_WINDOW_H / 2) - (help_h/2);
struct nk_rect help_rect = {help_x, help_y, help_w, help_h};
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "ANVSE Help", NK_WINDOW_TITLE|NK_WINDOW_CLOSABLE|NK_WINDOW_BORDER, help_rect))
{
nk_layout_row_dynamic(ctx, 20, 1);
nk_label(ctx, "Allegro Nuklear Visual Style Editor", NK_TEXT_CENTERED);
nk_label(ctx, "The editor starts with the default Nuklear Dark style.", NK_TEXT_LEFT);
nk_label(ctx, "Use FILE -> Open to load a saved style.", NK_TEXT_LEFT);
nk_label(ctx, "Use FILE -> Save to save a style. Make sure you give it a unique name.", NK_TEXT_LEFT);
nk_label(ctx, "When saving the style add the .txt extension my_style[.txt|.c|.h].", NK_TEXT_LEFT);
nk_label(ctx, "NOTE! Saved style files must follow the example format.", NK_TEXT_LEFT);
nk_label(ctx, "Additional lines or C style comments (// /* */) are not allowed.", NK_TEXT_LEFT);
nk_label(ctx, "", NK_TEXT_LEFT); // Seperator
nk_label(ctx, "Edit Theme.", NK_TEXT_CENTERED);
nk_label(ctx, "The Reset All Colors will reset all items to the original style", NK_TEXT_LEFT);
nk_label(ctx, "from the currently loaded file (or default style if no file loaded).", NK_TEXT_LEFT);
nk_label(ctx, "Most of the controls are straight forward. select each NK_COLOR_xxx item", NK_TEXT_LEFT);
nk_label(ctx, "and adjust the RGBA for the item. Press Apply to keep and test the color.", NK_TEXT_LEFT);
nk_label(ctx, "If the Cancel Change is pressed before Apply, the color setting is undone.", NK_TEXT_LEFT);
nk_label(ctx, "The top Reset this Color button will reset the adjustment for this item only.", NK_TEXT_LEFT);
nk_label(ctx, "", NK_TEXT_LEFT); // Seperator
nk_label(ctx, "BACKGROUND_COLOR.", NK_TEXT_CENTERED);
nk_label(ctx, "The background tree edit panel is seperat from all other items. You can", NK_TEXT_LEFT);
nk_label(ctx, "adjust a background color to test alpha transparency. In the right panel", NK_TEXT_LEFT);
nk_label(ctx, "you can select one of 2 background images or none for a flat color.", NK_TEXT_LEFT);
nk_label(ctx, "The Lock None and Lock All selection allows you to lock the alpha color", NK_TEXT_LEFT);
nk_label(ctx, "sliders togeter for all item adjustments.", NK_TEXT_LEFT);
nk_label(ctx, "---------", NK_TEXT_CENTERED);
nk_popup_end(ctx);
}
else help_dialog = nk_false;
}
/* About NK Theme */
if (about_dialog)
{
// Center dialog box on screen.
// TODO: Clean this up.
int about_w = 300;
int about_h = 210;
int about_x = (AL_WINDOW_W / 2) - (about_w/2);
int about_y = (AL_WINDOW_H / 2) - (about_h/2);
struct nk_rect about_rect = {about_x, about_y, about_w, about_h};
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "About", NK_WINDOW_TITLE|NK_WINDOW_CLOSABLE|NK_WINDOW_BORDER, about_rect))
{
nk_layout_row_dynamic(ctx, 20, 1);
nk_label(ctx, "Allegro Nuklear Visual Style Editor Std (ANVSE)", NK_TEXT_CENTERED);
nk_label(ctx, "Created by Axle", NK_TEXT_CENTERED); //
nk_label(ctx, "Licence MIT0", NK_TEXT_CENTERED);
nk_label(ctx, "Many thanks to Nuklear and Allegro creators", NK_TEXT_CENTERED);
nk_label(ctx, "as well as all contributors :)", NK_TEXT_CENTERED);
float ratios0[] = {0.30f, 0.40f, 0.30f};
nk_layout_row(ctx, NK_DYNAMIC, 40, 3, ratios0);
nk_label(ctx, "", NK_TEXT_LEFT);
if (nk_button_image(ctx, *logo))
{
; // Unused, Future.
}
nk_label(ctx, "", NK_TEXT_RIGHT);
nk_popup_end(ctx);
}
else about_dialog = nk_false;
}
// Do Exit check popup
// quit_app gets the logic from ALLEGRO_EVENT_DISPLAY_CLOSE in main()
if ((exit_check) || (*quit_app == 1))
{
int help_w = 260;
int help_h = 140;
int help_x = (AL_WINDOW_W / 2) - (help_w/2);
int help_y = (AL_WINDOW_H / 2) - (help_h/2);
struct nk_rect exit_rect = {help_x, help_y, help_w, help_h};
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "End application", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_CLOSABLE, exit_rect))
{
nk_layout_row_dynamic(ctx, 25, 1);
nk_label(ctx, "Do you want to end the application?", NK_TEXT_CENTERED);
nk_label(ctx, "Unsaved styles will be lost!", NK_TEXT_CENTERED);
nk_layout_row_dynamic(ctx, 25, 2);
if (nk_button_label(ctx, "OK"))
{
quit = nk_true;
nk_popup_close(ctx);
}
if (nk_button_label(ctx, "Cancel"))
{
exit_check = nk_false;
*quit_app = 0;
nk_popup_close(ctx);
}
nk_popup_end(ctx);
}
else
{
exit_check = nk_false;
}
if (quit)
{
// Send the quit logic to main loop.
*quit_app = 2;
exit_check = nk_false;
}
}
// Test header color popup.
if (popup_button)
{
static struct nk_rect s = {200, 100, 220, 110};
if (nk_popup_begin(ctx, NK_POPUP_STATIC, "Header Color", NK_WINDOW_TITLE|NK_WINDOW_BORDER|NK_WINDOW_CLOSABLE, s))
{
nk_layout_row_dynamic(ctx, 25, 1);
nk_label(ctx, "Example header color", NK_TEXT_LEFT);
nk_layout_row_dynamic(ctx, 25, 2);
if (nk_button_label(ctx, "OK"))
{
popup_button = 0;
nk_popup_close(ctx);
}
if (nk_button_label(ctx, "Cancel"))
{
popup_button = 0;
nk_popup_close(ctx);
}
nk_popup_end(ctx);
}
else
{
popup_button = nk_false;
}
}
if (show_title)
{
nk_layout_row_dynamic(ctx, 50, 1);
// nk_allegro5_font_set_font(NkAllegro5Font *allegro5font)
nk_allegro5_font_set_font(font_l);
nk_label(ctx, "Allegro Nuklear Visual Style Editor Std (ANVSE)", NK_TEXT_LEFT);
nk_allegro5_font_set_font(font);
}
// Horizontal rule/line
if (show_hr)
{
// Will create a horizontal line/divider.
nk_layout_row_dynamic(ctx, 2, 1);
// The last argument is for rounding of the box true|false
nk_rule_horizontal(ctx, ctx->style.window.border_color, nk_false);
}
// ###-> START TREE EDIT THEME ###
if (nk_tree_push(ctx, NK_TREE_TAB, "Edit Theme", NK_MINIMIZED))
{
//enum menu_states {MENU_DEFAULT, MENU_WINDOWS};
// 28 COLOR ITEMS
// EDIT THEME Adjusters
float ratios1[] = {0.15f, 0.85f}; // Slider ratio. Must be float!
// EDIT THEME storage examples
static int inactive = 1; // Active button examples
static int inactive_s = 1; // Active slider examples
static const float ratio2[] = {0.30f, 0.70f}; // Text enter examples
static char text1[1][64]; // Text enter examples
static int text_len[1]; // Text enter examples
// Check box examples
enum options_e {A,B,C};
static int option_left_e;
static int option_right_e;
// Selectable examples
static int selected_e[4] = {nk_false, nk_false, nk_true, nk_false};
// Color Slider examples
static struct nk_color combo_color_e = {130, 50, 50, 255};
float ratios_e[] = {0.15f, 0.85f};
// Progress bar examples
static nk_size prog_value_e = 40;
nk_layout_row_dynamic(ctx, 30, 1);
nk_label(ctx, "Adjust NK_THEME_COLOR_xxx", NK_TEXT_LEFT);
//nk_label(ctx, "Pressing reset all colors will revert to the original loaded theme.", NK_TEXT_LEFT);
nk_label_colored(ctx, "Pressing reset all colors will revert to the original loaded theme.", NK_TEXT_LEFT, nk_rgba(200,120,50,255));
if (nk_button_label(ctx, "Reset All Colors"))
{
// Apply the Altered color to the current theme|style
resetall = nk_true;
bg_resetall = nk_true;
}
if (nk_tree_push(ctx, NK_TREE_NODE, "BACKGROUND_COLOR", NK_MINIMIZED))
{
nk_layout_row_dynamic(ctx, 30, 1);
if (nk_button_label(ctx, "Background color reset"))
{
// Apply the Altered color to the current theme|style
bg_reset_nk_color = nk_true;
}
// START BACKGROUND_COLOR
nk_layout_row_dynamic(ctx, 360, 1); // Height
if (nk_group_begin(ctx, "Group_BACKGROUND_COLOR", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
// Do NK tree Backgrounds, transparency etc
// nk_bk_color
// Use to get NK colors
// ALLEGRO_COLOR al_map_rgba(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
nk_layout_row_begin(ctx, NK_STATIC, 350, 2); // 2 columns at height 320
nk_layout_row_push(ctx, 250); // Split columns by pixel width (col 1).
if (nk_group_begin(ctx, "Group_EDIT1", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
nk_layout_row_dynamic(ctx, 30, 1); // Height
nk_button_color(ctx, nk_bk_color[0]); //nk_button_color(ctx, nk_rgb(0,0,255));
// Slider adjust
//float ratios1[] = {0.15f, 0.85f}; // Slider ratio. Must be float!
nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratios1); // Must be float!
nk_label(ctx, "R:", NK_TEXT_LEFT);
nk_bk_color[0].r = (nk_byte)nk_slide_int(ctx, 0, nk_bk_color[0].r, 255, 5);
nk_label(ctx, "G:", NK_TEXT_LEFT);
nk_bk_color[0].g = (nk_byte)nk_slide_int(ctx, 0, nk_bk_color[0].g, 255, 5);
nk_label(ctx, "B:", NK_TEXT_LEFT);
nk_bk_color[0].b = (nk_byte)nk_slide_int(ctx, 0, nk_bk_color[0].b, 255, 5);
nk_label(ctx, "A:", NK_TEXT_LEFT);
nk_bk_color[0].a = (nk_byte)nk_slide_int(ctx, 0, nk_bk_color[0].a, 255, 5);
// Properties adjust
nk_layout_row_dynamic(ctx, 30, 1);
nk_bk_color[0].r = nk_propertyf(ctx, "#R:", 0, nk_bk_color[0].r, 255, 1,1);
nk_bk_color[0].g = nk_propertyf(ctx, "#G:", 0, nk_bk_color[0].g, 255, 1,1);
nk_bk_color[0].b = nk_propertyf(ctx, "#B:", 0, nk_bk_color[0].b, 255, 1,1);
nk_bk_color[0].a = nk_propertyf(ctx, "#A:", 0, nk_bk_color[0].a, 255, 1,1);
nk_layout_row_dynamic(ctx, 30, 2);
if (nk_button_label(ctx, "Apply Background"))
{
// Apply the Altered color to the current theme|style
// Note that nk_bk_color[0] automatically updates in real time,
// Which is different behaviour to the rest of the adjusters.
// An additional nk_bk_color[n] needs to be added to hold the adjustment,
// and then send to nk_bk_color[0] on "Apply".
bg_theme_apply = nk_true;
}
if (nk_button_label(ctx, "Cancel Change"))
{
// Clear the color sliders to current style.
bg_clear_change = nk_true;
}
nk_group_end(ctx); // END GROUP EDIT1
}
// START GROUP VIEW
nk_layout_row_push(ctx, 380); // Split columns by pixel width (col 2).
if (nk_group_begin(ctx, "Group_View1", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
nk_layout_row_dynamic(ctx, 25, 1);
//nk_label(ctx, "", NK_TEXT_LEFT); // Separator
nk_label(ctx, "Select background image [None|Image1|Image2].", NK_TEXT_LEFT);
if (nk_option_label(ctx, "Image None", bg_img_op == IMG_0))
{
bg_img_op = IMG_0;
*img_select = 0;
}
if (nk_option_label(ctx, "Image One", bg_img_op == IMG_1))
{
bg_img_op = IMG_1;
*img_select = 1;
}
if (nk_option_label(ctx, "Image Two", bg_img_op == IMG_2))
{
bg_img_op = IMG_2;
*img_select = 2;
}
nk_label(ctx, "", NK_TEXT_LEFT); // Separator
nk_label(ctx, "Lock all widget alpha sliders together.", NK_TEXT_LEFT);
nk_label(ctx, "Selecting Lock All will reset all transparency to 255.", NK_TEXT_LEFT);
nk_label(ctx, "Selecting Lock NONE will leave all transparency at current position.", NK_TEXT_LEFT);
nk_label(ctx, "This does not affect the background color.", NK_TEXT_LEFT);
// The alpha_flag logic switch is required.
if (nk_option_label(ctx, "Lock None", alpha_op == NONE))
{
alpha_op = NONE;
if (*alpha_flag == 0)
{
//alpha_all = 255; // Leave alpha sliders where they are.
*alpha_flag = 1;
}
}
if (nk_option_label(ctx, "Lock All", alpha_op == ALL))
{
alpha_op = ALL;
if (*alpha_flag == 1)
{
*alpha_all = 255; // this will reset all alpha on first pass.
*alpha_flag = 0;
theme_apply = nk_true;
}
}
nk_group_end(ctx); // END GROUP VIEW1
}// END GROUP VIEW1
nk_layout_row_end(ctx); // end split columns.
//
nk_group_end(ctx); // END Group_BACKGROUND_COLOR
} // END GROUP_NK_COLOR_TEXT
nk_tree_pop(ctx); // END Tree "Background Color"
} // END Tree "Background Color"
if (nk_tree_push(ctx, NK_TREE_NODE, "NK_COLOR_TEXT", NK_MINIMIZED))
{
nk_layout_row_dynamic(ctx, 30, 1);
if (nk_button_label(ctx, "Reset this Color"))
{
// Reset the color to the original loaded style.
reset_nk_color = NK_COLOR_TEXT;
}
// START GROUP_NK_COLOR_TEXT
nk_layout_row_dynamic(ctx, 360, 1); // Height
if (nk_group_begin(ctx, "Group_NK_COLOR_TEXT", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
//nk_layout_row_static(ctx, 380, 250, 2);
nk_layout_row_begin(ctx, NK_STATIC, 350, 2); // 2 columns at height 320
nk_layout_row_push(ctx, 250); // Split columns by pixel width (col 1).
if (nk_group_begin(ctx, "Group_EDIT1", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
nk_layout_row_dynamic(ctx, 30, 1); // Height
nk_button_color(ctx, table[0][NK_COLOR_TEXT]); //nk_button_color(ctx, nk_rgb(0,0,255));
// Slider adjust
//float ratios1[] = {0.15f, 0.85f}; // Slider ratio. Must be float!
nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratios1); // Must be float!
nk_label(ctx, "R:", NK_TEXT_LEFT);
table[0][NK_COLOR_TEXT].r = (nk_byte)nk_slide_int(ctx, 0, table[0][NK_COLOR_TEXT].r, 255, 5);
nk_label(ctx, "G:", NK_TEXT_LEFT);
table[0][NK_COLOR_TEXT].g = (nk_byte)nk_slide_int(ctx, 0, table[0][NK_COLOR_TEXT].g, 255, 5);
nk_label(ctx, "B:", NK_TEXT_LEFT);
table[0][NK_COLOR_TEXT].b = (nk_byte)nk_slide_int(ctx, 0, table[0][NK_COLOR_TEXT].b, 255, 5);
nk_label(ctx, "A:", NK_TEXT_LEFT);
if (alpha_op == ALL)
{
table[0][NK_COLOR_TEXT].a = *alpha_all;
}
table[0][NK_COLOR_TEXT].a = (nk_byte)nk_slide_int(ctx, 0, table[0][NK_COLOR_TEXT].a, 255, 5);
if (alpha_op == ALL)
{
*alpha_all = table[0][NK_COLOR_TEXT].a;
}
// Properties adjust
nk_layout_row_dynamic(ctx, 30, 1);
table[0][NK_COLOR_TEXT].r = nk_propertyf(ctx, "#R:", 0, table[0][NK_COLOR_TEXT].r, 255, 1,1);
table[0][NK_COLOR_TEXT].g = nk_propertyf(ctx, "#G:", 0, table[0][NK_COLOR_TEXT].g, 255, 1,1);
table[0][NK_COLOR_TEXT].b = nk_propertyf(ctx, "#B:", 0, table[0][NK_COLOR_TEXT].b, 255, 1,1);
if (alpha_op == ALL)
{
table[0][NK_COLOR_TEXT].a = *alpha_all;
}
table[0][NK_COLOR_TEXT].a = nk_propertyf(ctx, "#A:", 0, table[0][NK_COLOR_TEXT].a, 255, 1,1);
if (alpha_op == ALL)
{
*alpha_all = table[0][NK_COLOR_TEXT].a;
}
nk_layout_row_dynamic(ctx, 30, 2);
if (nk_button_label(ctx, "Apply Color"))
{
// Apply the Altered color to the current theme|style
theme_apply = nk_true;
}
if (nk_button_label(ctx, "Cancel Change"))
{
// Clear the color sliders to current style.
clear_change = nk_true;
}
nk_group_end(ctx); // END GROUP EDIT1
}
// START GROUP VIEW
nk_layout_row_push(ctx, 380); // Split columns by pixel width (col 2).
if (nk_group_begin(ctx, "Group_View1", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
nk_layout_row_dynamic(ctx, 25, 1);
//nk_layout_row_static(ctx, 30, 350, 1);
nk_button_label(ctx, "Sample button");
nk_label(ctx, "", NK_TEXT_LEFT); // Separator
nk_label(ctx, "Sample Label", NK_TEXT_LEFT);
nk_label(ctx, "", NK_TEXT_LEFT); // Separator
// Symbols
nk_layout_row_static(ctx, 25, 25, 8);
nk_button_symbol(ctx, NK_SYMBOL_CIRCLE_SOLID);
nk_button_symbol(ctx, NK_SYMBOL_CIRCLE_OUTLINE);
nk_button_symbol(ctx, NK_SYMBOL_RECT_SOLID);
nk_button_symbol(ctx, NK_SYMBOL_RECT_OUTLINE);
nk_button_symbol(ctx, NK_SYMBOL_TRIANGLE_UP);
nk_button_symbol(ctx, NK_SYMBOL_TRIANGLE_DOWN);
nk_button_symbol(ctx, NK_SYMBOL_TRIANGLE_LEFT);
nk_button_symbol(ctx, NK_SYMBOL_TRIANGLE_RIGHT);
nk_label(ctx, "", NK_TEXT_LEFT); // Separator
// Button active|inactive example
nk_layout_row_dynamic(ctx, 25, 1);
nk_checkbox_label(ctx, "Inactive", &inactive);
nk_layout_row_static(ctx, 25, 80, 1);
if (inactive)
{
nk_widget_disable_begin(ctx);
}
nk_button_label(ctx, "button");
nk_widget_disable_end(ctx);
nk_label(ctx, "", NK_TEXT_LEFT); // Separator
// Text enter example
//static const float ratio2[] = {0.30f, 0.70f}; // Text enter examples
//static char text1[1][64]; // Text enter examples
//static int text_len[1]; // Text enter examples
nk_layout_row(ctx, NK_DYNAMIC, 25, 2, ratio2);
nk_label(ctx, "Default:", NK_TEXT_LEFT);
nk_edit_string(ctx, NK_EDIT_SIMPLE, text1[0], &text_len[0], 64, nk_filter_default);
nk_group_end(ctx); // END GROUP VIEW1
} // END GROUP VIEW1
nk_layout_row_end(ctx); // end split columns.
//
nk_group_end(ctx); // END GROUP_NK_COLOR_TEXT
} // END GROUP_NK_COLOR_TEXT
nk_tree_pop(ctx); // END Tree "Edit Theme"
} // END Tree "Edit Theme"
if (nk_tree_push(ctx, NK_TREE_NODE, "NK_COLOR_WINDOW", NK_MINIMIZED))
{
nk_layout_row_dynamic(ctx, 30, 1);
if (nk_button_label(ctx, "Reset this Color"))
{
// Reset the color to the original loaded style.
reset_nk_color = NK_COLOR_WINDOW;
}
// Group_NK_COLOR_WINDOW
nk_layout_row_dynamic(ctx, 360, 1); // Height
if (nk_group_begin(ctx, "Group_NK_COLOR_WINDOW", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{
//nk_layout_row_static(ctx, 380, 250, 2);
nk_layout_row_begin(ctx, NK_STATIC, 350, 2); // 2 columns at height 320
nk_layout_row_push(ctx, 250); // Split columns by pixel width (col 1).
if (nk_group_begin(ctx, "Group_EDIT2", NK_WINDOW_NO_SCROLLBAR|NK_WINDOW_BORDER))
{