diff options
Diffstat (limited to 'src/frontend/dialog_rename.fl')
-rwxr-xr-x | src/frontend/dialog_rename.fl | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/frontend/dialog_rename.fl b/src/frontend/dialog_rename.fl new file mode 100755 index 0000000..d7bd419 --- /dev/null +++ b/src/frontend/dialog_rename.fl | |||
@@ -0,0 +1,89 @@ | |||
1 | # data file for the Fltk User Interface Designer (fluid) | ||
2 | version 1.0107 | ||
3 | header_name {.h} | ||
4 | code_name {.cxx} | ||
5 | decl {\#include <hd24fs.h>} {public | ||
6 | } | ||
7 | |||
8 | decl {\#include <FL/fl_ask.H>} {public | ||
9 | } | ||
10 | |||
11 | class dialog_rename {open | ||
12 | } { | ||
13 | decl {int buttonclicked;} {public | ||
14 | } | ||
15 | decl {hd24song* currsong;} {} | ||
16 | decl {string* itemname;} {public | ||
17 | } | ||
18 | Function {~dialog_rename()} {open | ||
19 | } { | ||
20 | code {if (itemname!=NULL) delete itemname;} {} | ||
21 | } | ||
22 | decl {int locnum;} {} | ||
23 | Function {make_window(string* p_currname,string* p_title)} {open | ||
24 | } { | ||
25 | Fl_Window renamewindow { | ||
26 | label Rename open | ||
27 | xywh {111 127 490 75} type Double color 52 | ||
28 | code0 {buttonclicked=0;} | ||
29 | code1 {currname->value(p_currname->c_str());} | ||
30 | code2 {o->label(p_title->c_str());} modal visible | ||
31 | } { | ||
32 | Fl_Button button_ok { | ||
33 | label OK | ||
34 | callback {buttonclicked=1; //OK | ||
35 | char dest[66]; | ||
36 | strncpy(&dest[0],currname->value(),64); | ||
37 | dest[64]='\\0'; | ||
38 | itemname=new string(dest); | ||
39 | Fl_Window * x = Fl::first_window(); | ||
40 | x->~Fl_Window();} | ||
41 | xywh {330 40 70 25} | ||
42 | } | ||
43 | Fl_Button button_cancel { | ||
44 | label Cancel | ||
45 | callback {buttonclicked=2; //Cancel | ||
46 | Fl_Window * x = Fl::first_window(); | ||
47 | x->~Fl_Window();} | ||
48 | xywh {405 40 70 25} | ||
49 | } | ||
50 | Fl_Input currname { | ||
51 | label {New Name:} | ||
52 | callback {char filteredname[65]; | ||
53 | int x=strlen(o->value()); | ||
54 | if (x>64) { x=64; } | ||
55 | int src=0; | ||
56 | int filtered=0; | ||
57 | for (int i=0;i<x;i++) { | ||
58 | if ( | ||
59 | (o->value()[i]=='\\\\') | ||
60 | || (o->value()[i]=='/') | ||
61 | || (o->value()[i]==':') | ||
62 | || (o->value()[i]=='*') | ||
63 | || (o->value()[i]=='?') | ||
64 | || (o->value()[i]=='"') | ||
65 | || (o->value()[i]=='<') | ||
66 | || (o->value()[i]=='>') | ||
67 | || (o->value()[i]=='\\\\') | ||
68 | || (o->value()[i]=='|')) | ||
69 | { | ||
70 | filtered=1; | ||
71 | continue; | ||
72 | } | ||
73 | filteredname[src]=o->value()[i]; | ||
74 | src++; | ||
75 | } | ||
76 | filteredname[src]='\\0'; | ||
77 | if (filtered==1) { | ||
78 | int pos=o->position()-1; | ||
79 | if (pos<0) pos=0; | ||
80 | o->value(filteredname); | ||
81 | o->position(pos,pos); | ||
82 | }} selected | ||
83 | xywh {90 10 385 20} labelsize 12 when 1 textsize 12 | ||
84 | code0 {o->maximum_size(64);} | ||
85 | code1 {o->take_focus();} | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | } | ||