1 # data file for the Fltk User Interface Designer (fluid)
4 i18n_include <libintl.h>
8 decl {\#include <faraon.H>} {global
11 decl {\#include <FL/fl_ask.H>} {global
14 decl {\#include <FL/Fl_Preferences.H>} {global
17 decl {\#include <Flek/Fl_Toggle_Tree.H>} {public global
20 decl {\#include <scroll.H>} {public global
23 decl {Fl_Toggle_Tree *config_tree;} {global
26 decl {Fl_Toggle_Tree *slices_tree;} {global
29 decl {Fl_Toggle_Tree *select_slice_tree;} {global
32 decl {u32_t current_slice_id, selected_slice_id;} {global
35 decl {string current_slice_name;} {global
38 decl {sfinx_file_t current_files_module_tree_path(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);} {}
40 decl {sfinx_note_t current_note;} {}
42 Function {relink_slice_action()} {private return_type void
44 code {sfinx_slice_t slice(SFINX_SLICE_RELINK);
45 slice.slice_id = current_slice_id;
46 slice.parent_slice_id = selected_slice_id; //(u32_t) node->user_data();
47 slice.name(""); // for size update
48 app->sfinx.send(slice);
49 select_slice_w->hide();
50 app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);} {}
53 Function {select_file_main_slice_action()} {private return_type void
55 code {//debug("selected slice - %d [%s]", current_slice_id, current_slice_name.c_str());
56 file_main_slice_b->user_data(to_voidp(current_slice_id));
58 l = current_slice_name;
59 file_main_slice_b->label(l.c_str());
60 file_main_slice_b->redraw();
61 // check for additional slices if it is here - remove it
62 for (int i = 1; i <= file_additional_slices_br->size(); i++) {
63 if (file_additional_slices_br->data(i) == to_voidp(current_slice_id)) {
64 file_additional_slices_br->remove(i);
70 Function {select_file_additional_slice_action()} {private return_type void
72 code {if (to_voidp(current_slice_id) == file_main_slice_b->user_data()) // already set as main slice
74 for (int i = 1; i <= file_additional_slices_br->size(); i++) {
75 if (file_additional_slices_br->data(i) == to_voidp(current_slice_id))
78 file_additional_slices_br->add(current_slice_name.c_str(), to_voidp(current_slice_id));
79 file_additional_slices_br->redraw();} {}
82 Function {search_add_slice_action()} {private return_type void
84 code {for (int i = 1; i <= search_slices_br->size(); i++) {
85 if (search_slices_br->data(i) == to_voidp(current_slice_id))
88 search_slices_br->add(current_slice_name.c_str(), to_voidp(current_slice_id));
89 search_slices_br->redraw();} {}
92 Function {slices_tree_cb(Fl_Widget *, void *)} {private return_type void
94 code {Fl_Toggle_Node *node = slices_tree->selected();
97 current_slice_id = from_voidp(node->user_data());
98 current_slice_name = node->label();
99 if (!Fl::event_clicks())
101 void (*select_slice_action)(void) = (void (*)())(slices_w->user_data());
102 if (select_slice_action) {
104 slices_w->user_data(0);
105 select_slice_action();
109 Function {select_slice_tree_cb(Fl_Widget *, void *)} {private return_type void
111 code {if (!Fl::event_clicks())
113 select_slice_b->do_callback();} {}
116 Function {write_preferences()} {private return_type void
118 code {app->server_name = config_sfinx_server_name_i->value();
119 app->files_module_conf.clear();
120 app->files_module_conf.add(FILES_MODULE_UNSORTED_PATH,
121 config_files_module_unsorted_path_i->value());
122 app->files_module_conf.add(FILES_MODULE_SORTED_TREE_PATH,
123 config_files_module_sorted_path_i->value());
124 app->files_module_conf.add(FILES_MODULE_DESC_FILE_NAME,
125 config_files_module_desc_file_name_i->value());
126 app->files_module_conf.add(FILES_MODULE_DESC_FILE_ENABLE,
127 gen_desc_files_b->value());
128 app->write_preferences();} {}
131 Function {config_tree_cb(Fl_Widget *, void *)} {private return_type void
133 code {static Fl_Group *prev_group;
134 Fl_Toggle_Node *node = config_tree->selected();
136 Fl_Group *gr = *((Fl_Group **)(node->user_data()));
141 //config_tree->unselect();
145 Function {fill_config_tree()} {private return_type void
147 code {config_tree->add_next("Connection", 0, 0, (void *)&config_connection_gr);
148 config_tree->add_next("Files Module", 0, 0, (void *)&config_files_module_gr);
149 config_tree->add_next("Confirmation", 0, 0, (void *)&config_confirmation_gr);
150 config_tree->callback(config_tree_cb);
151 config_tree->edit_on_reselect(0);} {}
154 Function {x11_ui::init()} {open private return_type void
158 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
159 F::shutdown(0);} open
160 xywh {34 45 940 365} type Double hide
167 xywh {0 0 67 22} labeltype ENGRAVED_LABEL
170 label {Connect to ...}
171 xywh {0 0 34 22} shortcut 0x80063 labeltype ENGRAVED_LABEL deactivate
174 label {Connect to default server}
175 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
178 label {Disconnect from Sfinx}
179 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
182 label {Connection Info}
183 xywh {20 20 34 22} shortcut 0x80069 labeltype ENGRAVED_LABEL deactivate
187 xywh {30 30 34 22} labeltype ENGRAVED_LABEL deactivate divider
191 callback {app->read_preferences();
192 config_sfinx_server_name_i->value(app->server_name.c_str());
193 preferences_w->show();}
194 xywh {30 30 34 22} shortcut 0x80070 labeltype ENGRAVED_LABEL divider
198 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
200 xywh {20 20 34 22} shortcut 0x80078 labeltype ENGRAVED_LABEL
205 xywh {10 10 67 22} labeltype ENGRAVED_LABEL
209 callback {if (!app->connected()) {
210 fl_message("Not connected to Sfinx Server !");
213 if (app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0))
216 xywh {10 10 34 22} shortcut 0x61 labeltype ENGRAVED_LABEL deactivate
220 callback {if (!app->connected()) {
221 fl_message("Not connected to Sfinx Server !");
224 if (app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0))
227 xywh {10 10 34 22} shortcut 0x73 labeltype ENGRAVED_LABEL
230 label {Knowledge Module}
231 callback {if (!app->connected()) {
232 fl_message("Not connected to Sfinx Server !");
235 xywh {40 40 34 22} shortcut 0x6b labeltype ENGRAVED_LABEL deactivate
239 callback {if (!app->connected()) {
240 fl_message("Not connected to Sfinx Server !");
243 xywh {40 40 34 22} shortcut 0x74 labeltype ENGRAVED_LABEL deactivate
247 callback {if (!app->connected()) {
248 fl_message("Not connected to Sfinx Server !");
251 xywh {40 40 34 22} shortcut 0x6d labeltype ENGRAVED_LABEL deactivate
255 callback {if (!app->connected()) {
256 fl_message("Not connected to Sfinx Server !");
259 xywh {50 50 34 22} shortcut 0x63 labeltype ENGRAVED_LABEL deactivate
263 callback {if (!app->connected()) {
264 fl_message("Not connected to Sfinx Server !");
267 xywh {40 40 34 22} shortcut 0x65 labeltype ENGRAVED_LABEL deactivate
271 callback {if (!app->connected()) {
272 fl_message("Not connected to Sfinx Server !");
275 app->sfinx.send(SFINX_FILES_MODULE_CONF_REQUEST, (u8_t) 0);
276 if (app->sfinx.send(current_files_module_tree_path))
278 files_module_w->show();}
279 xywh {20 20 34 22} shortcut 0x66 labeltype ENGRAVED_LABEL
283 callback {if (!app->connected()) {
284 fl_message("Not connected to Sfinx Server !");
287 current_note.id(SFINX_NOTES_MODULE_TREE_REQUEST);
288 if (app->sfinx.send(current_note))
291 xywh {30 30 34 22} shortcut 0x6e labeltype ENGRAVED_LABEL
296 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
299 label {Browser && Searcher}
300 callback {if (!app->connected()) {
301 fl_message("Not connected to Sfinx Server !");
304 search_i->take_focus();
306 xywh {30 30 34 22} shortcut 0x62 labeltype ENGRAVED_LABEL
310 callback {if (!app->connected()) {
311 fl_message("Not connected to Sfinx Server !");
314 xywh {30 30 34 22} shortcut 0x72 labeltype ENGRAVED_LABEL deactivate divider
318 callback {if (!app->connected()) {
319 fl_message("Not connected to Sfinx Server !");
322 xywh {40 40 34 22} shortcut 0x40061 labeltype ENGRAVED_LABEL deactivate
325 label {Knowledge Tracer}
326 callback {if (!app->connected()) {
327 fl_message("Not connected to Sfinx Server !");
330 xywh {40 40 34 22} shortcut 0x4006b labeltype ENGRAVED_LABEL deactivate
333 label {Indexing machine}
334 callback {if (!app->connected()) {
335 fl_message("Not connected to Sfinx Server !");
338 xywh {30 30 34 22} shortcut 0x40069 labeltype ENGRAVED_LABEL deactivate
341 label {Check Sfinx DB}
342 callback {if (!app->connected()) {
343 fl_message("Not connected to Sfinx Server !");
346 xywh {40 40 34 22} shortcut 0x40064 labeltype ENGRAVED_LABEL deactivate
350 callback {if (!app->connected()) {
351 fl_message("Not connected to Sfinx Server !");
354 xywh {30 30 34 22} shortcut 0x40062 labeltype ENGRAVED_LABEL deactivate divider
357 label {Clear log window}
358 callback {log_br->clear();}
359 xywh {30 30 34 22} shortcut 0x10063 labeltype ENGRAVED_LABEL
364 xywh {20 20 67 22} labeltype ENGRAVED_LABEL deactivate
368 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
372 xywh {30 30 34 22} shortcut 0xffbe labeltype ENGRAVED_LABEL deactivate divider
376 callback {about_w->show();}
377 xywh {30 30 34 22} shortcut 0x80061 labeltype ENGRAVED_LABEL
381 Fl_Output status_bar_o {
382 tooltip Status xywh {0 347 940 20} box PLASTIC_UP_BOX color 31 deactivate
385 xywh {-1 21 943 326} type Select color 31 labelfont 4 textfont 4
388 Fl_Window preferences_w {
390 xywh {215 308 742 373} type Double color 31 hide
394 callback {preferences_w->hide();}
395 xywh {390 330 112 25} labeltype ENGRAVED_LABEL
399 callback {write_preferences();
400 preferences_w->hide();}
401 xywh {572 330 112 25} labeltype ENGRAVED_LABEL
403 Fl_Scroll prefs_tree_scroll {
404 xywh {10 29 173 283} type VERTICAL_ALWAYS box ENGRAVED_FRAME color 28
405 code0 {config_tree = new Fl_Toggle_Tree(12, 12, prefs_tree_scroll->w() - prefs_tree_scroll->scrollbar.w(), 10);}
406 code1 {fill_config_tree();}
408 Fl_Group config_connection_gr {open
409 xywh {183 19 535 283} box ENGRAVED_FRAME hide
411 Fl_Input config_sfinx_server_name_i {
412 label {Sfinx Server Name}
413 xywh {273 89 375 26} color 29 labeltype ENGRAVED_LABEL align 1
416 label {Minimum Auth Level}
417 xywh {227 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
420 label {User Name && Passsword}
429 label {Minimum Debug Level}
430 xywh {227 230 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
449 label {Warning Level}
461 label {Critical Level}
470 label {Minimum Crypt Level}
471 xywh {476 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
483 Fl_Group config_files_module_gr {
484 xywh {193 29 535 283} box ENGRAVED_FRAME hide
486 Fl_Input config_files_module_unsorted_path_i {
487 label {Unsorted files path on Sfinx server}
488 xywh {283 68 375 26} color 29 labeltype ENGRAVED_LABEL align 1
490 Fl_Input config_files_module_sorted_path_i {
491 label {Sorted file tree path on Sfinx server}
492 xywh {283 128 375 26} color 29 labeltype ENGRAVED_LABEL align 1
494 Fl_Check_Button gen_desc_files_b {
495 label {Generate description files}
496 xywh {209 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
498 Fl_Input config_files_module_desc_file_name_i {
499 label {Description file name}
500 xywh {283 189 375 26} color 29 labeltype ENGRAVED_LABEL align 1
502 Fl_Check_Button process_files_mime_type_b {
503 label {Detect files MIME type}
504 xywh {472 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
507 Fl_Group config_confirmation_gr {
508 xywh {183 19 535 283} box ENGRAVED_FRAME hide
510 Fl_Check_Button exit_confirm_b {
512 xywh {216 45 204 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL deactivate
516 Fl_Window select_slice_w {
517 label {Select Sfinx Object}
518 xywh {165 227 730 370} type Double color 31 hide modal
522 callback {select_slice_w->hide();}
523 xywh {594 312 112 25} labeltype ENGRAVED_LABEL
525 Fl_Button select_slice_b {
527 callback {Fl_Toggle_Node *node = select_slice_tree->selected();
530 selected_slice_id = from_voidp(node->user_data());
531 void (*select_slice_action)(void) = (void (*)())(select_slice_b->user_data());
532 select_slice_action();}
533 xywh {21 312 312 25} labeltype ENGRAVED_LABEL
535 Fl_Scroll select_slice_tree_scroll {open
536 xywh {15 15 702 280} box ENGRAVED_FRAME color 28
537 code0 {select_slice_tree = new Fl_Toggle_Tree(12, 12, select_slice_tree_scroll->w(), 10);}
538 code1 {select_slice_tree->callback(select_slice_tree_cb);}
539 code2 {select_slice_w->resizable(select_slice_tree_scroll);}
540 code3 {select_slice_tree_scroll->resizable(select_slice_tree);}
541 class Fl_Scroll_Resize
543 Fl_Output select_slice_status_to {
544 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31 deactivate
546 Fl_Choice select_object_type_ch {
548 xywh {360 313 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5
566 xywh {172 126 730 370} type Double color 31 hide modal
570 callback {slices_w->hide();}
571 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
575 callback {Fl_Toggle_Node *node = slices_tree->selected();
578 if (current_slice_id == 1) // Root Slice can't be deleted
580 // set safe deletion mode
581 slice_deletion_type_ch->value(0);
582 data_deletion_type_ch->value(0);
583 delete_sfinx_slice_to->value(current_slice_name.c_str());
584 delete_slice_w->show();}
585 xywh {456 312 128 25} labeltype ENGRAVED_LABEL
587 Fl_Scroll slices_tree_scroll {open
588 xywh {15 15 702 280} box ENGRAVED_FRAME color 28
589 code0 {slices_tree = new Fl_Toggle_Tree(12, 12, slices_tree_scroll->w() /*- slices_tree_scroll->scrollbar.w()*/, 10);}
590 code1 {slices_tree->callback(slices_tree_cb);}
591 code2 {slices_w->resizable(slices_tree_scroll);}
592 code3 {slices_tree_scroll->resizable(slices_tree);}
593 class Fl_Scroll_Resize
597 callback {Fl_Toggle_Node *node = slices_tree->selected();
600 edit_slice_w->user_data(node->user_data());
601 app->sfinx.send(SFINX_EDIT_SLICE_REQUEST, (u32_t)from_voidp(node->user_data()));
602 edit_slice_w->label("Edit Sfinx Slice");}
603 xywh {305 312 128 25} labeltype ENGRAVED_LABEL
605 Fl_Output slices_status_to {
606 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31 deactivate
610 callback {Fl_Toggle_Node *node = slices_tree->selected();
612 fl_alert("Please select slice connection point !");
615 edit_slice_w->user_data(0); // new slice
616 slice_name_i->value(0);
617 slice_directory_i->value(0);
618 slice_name_i->take_focus();
619 slice_description_i->value(0);
620 edit_slice_to->value(string(string("Parent slice: ") + current_slice_name).c_str());
621 edit_slice_w->label("New Sfinx Slice");
622 edit_slice_w->show();}
623 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
627 callback {Fl_Toggle_Node *node = slices_tree->selected();
630 if (app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST_EXCEPT, (u32_t)current_slice_id))
632 select_slice_b->user_data((void *)relink_slice_action);
633 select_slice_w->show();}
634 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
637 Fl_Window edit_slice_w {
638 label {Edit Sfinx Slice}
639 xywh {276 319 595 330} type Double color 31 hide modal
641 Fl_Input slice_name_i {
643 xywh {47 35 496 26} color 29 labeltype ENGRAVED_LABEL align 1
645 Fl_Input slice_directory_i {
646 label {Slice Directory}
647 xywh {47 93 496 26} color 29 labeltype ENGRAVED_LABEL align 1
649 Fl_Input slice_description_i {
650 label {Slice Description}
651 xywh {34 158 523 89} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
653 Fl_Return_Button {} {
655 callback {if (!slice_name_i->size()) {
656 fl_message("Missing slice name !");
659 u32_t slice_id = from_voidp(edit_slice_w->user_data());
662 slice.id(SFINX_EDIT_SLICE);
664 slice.id(SFINX_NEW_SLICE);
665 slice.name(slice_name_i->value());
666 slice.directory(slice_directory_i->value());
667 slice.description(slice_description_i->value());
668 slice.slice_id = slice_id;
669 slice.parent_slice_id = current_slice_id;
670 app->sfinx.send(slice);
671 edit_slice_w->hide();
672 app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);}
673 xywh {111 270 112 25} labeltype ENGRAVED_LABEL
677 callback {edit_slice_w->hide();}
678 xywh {359 270 112 25} labeltype ENGRAVED_LABEL
680 Fl_Output edit_slice_to {
681 xywh {0 312 598 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
684 Fl_Window delete_slice_w {
685 label {Delete Sfinx Slice}
686 xywh {252 500 388 223} type Double color 31 hide modal
690 callback {delete_slice_w->hide();}
691 xywh {238 175 112 25} labeltype ENGRAVED_LABEL
695 callback {// need to confirm deletion ?!
696 bool recursivly = slice_deletion_type_ch->value();
698 app->sfinx.send(data_deletion_type_ch->value() ?
699 (recursivly ? SFINX_DELETE_SLICE_ASSOC_DATA_RECURSIVLY : SFINX_DELETE_SLICE_ASSOC_DATA) :
700 (recursivly ? SFINX_DELETE_SLICE_MARK_DATA_UNSORTED_RECURSIVLY : SFINX_DELETE_SLICE_MARK_DATA_UNSORTED),
701 (u32_t)current_slice_id);
702 app->sfinx.send(recursivly ? SFINX_DELETE_SLICE_RECURSIVLY : SFINX_DELETE_SLICE_WITH_REATTACH,
703 (u32_t)current_slice_id);
704 delete_slice_w->hide();
705 app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);}
706 xywh {39 175 112 25} labeltype ENGRAVED_LABEL
708 Fl_Output delete_sfinx_slice_to {
709 label {Please confirm deletion of the slice}
710 xywh {35 31 330 26} box ENGRAVED_FRAME color 29 labeltype ENGRAVED_LABEL align 1
712 Fl_Choice slice_deletion_type_ch {
713 label {Slice && Data Deletion Type}
714 xywh {73 82 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5
717 label {Attach subslices to parent}
721 label {Delete all subslices recursivly}
725 Fl_Choice data_deletion_type_ch {
726 label {Associated Data Deletion Type}
727 xywh {73 132 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5
730 label {Mark all data 'Unsorted'}
734 label {Delete all data}
739 Fl_Window progress_w {
741 xywh {286 302 464 98} type Double hide
743 Fl_Progress progress_bar {
745 xywh {22 46 422 27} box PLASTIC_DOWN_BOX selection_color 2
748 label {Doing some work ...}
749 xywh {66 10 330 25} box FLAT_BOX labeltype ENGRAVED_LABEL
752 Fl_Window files_module_w {
754 xywh {83 125 730 370} type Double color 31 hide resizable
758 callback {files_module_w->hide();}
759 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
761 Fl_Output files_module_status_to {
762 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
764 Fl_Button classify_file_b {
766 callback {int n = files_module_tree_br->value();
769 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
770 //debug("slice_id - %d, parent_id - %d, name - %s", current_files_module_tree_path.file_id, current_files_module_tree_path.main_slice_id,
771 // file->name.c_str());
773 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
774 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
776 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, path);
778 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
779 file->etime.GetDate(eyear, emonth, eday);
780 file->etime.GetTime(ehour, emin, esec);
781 file->ctime.GetDate(cyear, cmonth, cday);
782 file->ctime.GetTime(chour, cmin, csec);
783 sprintf(buf, "%llu bytes | Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", file->fsize, cday, cmonth,
784 cyear, chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
785 string t = "URL: " + path + current_files_module_tree_path.name + "/" + file->name + " | " + file->mimetype + " | Size: " + buf;
786 classify_file_to->value(t.c_str());
787 file_title_i->value(0);
788 file_name_i->value(file->name.c_str());
789 // save orig file name
790 file->orig_name = file->name;
791 file->id(SFINX_FILES_MODULE_CLASSIFY_REQUEST); // new file
792 file_title_i->take_focus();
793 file_authority_i->value(0);
794 file_description_i->value(0);
795 file_comments_i->value(0);
796 sorted_location_b->value(1);
797 file_compress_b->value(1);
798 file_gen_csum_b->value(1);
799 file_main_slice_b->label("Main Slice (Not Set)");
800 file_main_slice_b->user_data(0); // ÔÕÔÁ ÈÒÁÎÉÔÓÑ slice_id
801 file_additional_slices_br->clear();
802 classify_file_w->user_data((void *)file);
803 classify_file_w->show();}
804 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
808 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
810 Fl_Browser files_module_tree_br {
811 callback {if (!Fl::event_clicks())
813 sfinx_files_vector_t *tree = (sfinx_files_vector_t *) files_module_tree_br->user_data();
814 int n = files_module_tree_br->value();
815 //debug("selected %s file", tree->files[n - 1]->url.c_str());
816 if (tree->files[n - 1]->is_directory) { // ÀÚÅÒ ÓÍÅÎÉÌ ÄÉÒÅËÔÏÒÉÀ
817 // × file_id ÈÒÁÎÉÔÓÑ id ÔÅËÕÝÅÊ ÄÉÒÅËÔÏÒÉÉ-ÓÌÁÊÓÁ × ËÏÔÏÒÏÊ ÎÁÈÏÄÉÍÓÑ/×ÙÂÒÁÌÉ
818 // × main_obj_id - parent_id ÄÉÒÅËÔÏÒÉÉ
819 // ÚÁÈÏÄÉÍ × ÄÉÒÅËÔÏÒÉÀ - ÔÅËÕÝÁÑ ÓÔÁÎÏ×ÉÔÓÑ parent'ÏÍ
820 current_files_module_tree_path.file_id = tree->files[n - 1]->file_id;
821 current_files_module_tree_path.main_obj_id = tree->files[n - 1]->main_obj_id;
822 // × name ÈÒÁÎÉÔÓÑ ×ÅÓØ ÐÕÔØ ÏÔ root location
823 // × orig_name ÔÏÌØËÏ ÉÍÑ ÔÅËÕÝÅÊ
824 string t = current_files_module_tree_path.name.c_str();
825 // current_files_module_tree_path.orig_name = tree->files[n - 1]->name;
826 t += ('/' + tree->files[n - 1]->name);
827 current_files_module_tree_path.name = t;
828 //debug("requesting dir %s", current_files_module_tree_path.c_str());
829 app->sfinx.send(current_files_module_tree_path);
831 if (!(tree->files[n - 1]->file_id)) // classify file
832 classify_file_b->do_callback();
834 // app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0); // prepare for slice_name() calls
835 sfinx_file_t *file = tree->files[n - 1];
836 file->id(SFINX_FILES_MODULE_EDIT_FILE_REQUEST);
837 app->sfinx.send(file);
840 xywh {8 45 716 255} type Multi color 31 resizable
841 code0 {static int widths[] = { 10, 450, 200, 200, 0};}
842 code1 {files_module_tree_br->column_widths(widths);}
846 callback {int n = files_module_tree_br->value();
849 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
851 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) {
853 string message = "Deleting \\'" + file->name + "\\'. Are you sure ?";
854 if (fl_choice(message.c_str(), "Yes", "No", 0L))
856 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
857 path += "/" + file->name;
858 sfinx_string_t f(SFINX_FILES_MODULE_UNLINK);
862 // sorted can be marked unsorted or deleted
863 string message = "Delete or Unsort \\'" + file->name + "\\' ?";
864 int res = fl_choice(message.c_str(), "Cancel", "Unsort", "Delete");
867 if (res == 2) { // delete
868 file->id(SFINX_FILES_MODULE_SORTED_UNLINK);
869 app->sfinx.send(file);
871 file->id(SFINX_FILES_MODULE_UNSORT);
872 app->sfinx.send(file);
875 //files_module_tree_br->remove(n);
876 app->sfinx.send(current_files_module_tree_path);}
877 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
879 Fl_Button select_files_tree_b {
881 callback {files_module_tree_br->clear();
882 current_files_module_tree_path.name.clear();
883 current_files_module_tree_path.orig_name.clear();
884 if (select_files_tree_b->user_data()) {
885 select_files_tree_b->user_data(0);
886 select_files_tree_b->label("Sorted tree");
887 current_files_module_tree_path.id(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);
888 current_files_module_tree_path.file_id = 0;
890 select_files_tree_b->user_data((void *)1);
891 select_files_tree_b->label("Unsorted tree");
892 current_files_module_tree_path.id(SFINX_FILES_MODULE_SORTED_TREE_REQUEST);
893 current_files_module_tree_path.file_id = 1; // root id
896 select_files_tree_b->redraw();
897 app->sfinx.send(current_files_module_tree_path);}
898 xywh {562 10 128 25} labeltype ENGRAVED_LABEL
902 callback {const char *p = strrchr(current_files_module_tree_path.name.c_str(), '/');
904 current_files_module_tree_path.name.clear();
908 strncat(path, current_files_module_tree_path.name.c_str(), p - current_files_module_tree_path.name.c_str());
909 current_files_module_tree_path.name = path;
910 current_files_module_tree_path.file_id = current_files_module_tree_path.main_obj_id;
912 app->sfinx.send(current_files_module_tree_path);}
913 xywh {35 10 112 25} labeltype ENGRAVED_LABEL
917 callback {app->sfinx.send(current_files_module_tree_path);}
918 xywh {166 10 112 25} labeltype ENGRAVED_LABEL
922 callback {for (int i = 1; i <= files_module_tree_br->size(); i++)
923 files_module_tree_br->select(i);}
924 xywh {295 10 112 25} labeltype ENGRAVED_LABEL
928 callback {files_module_tree_br->deselect();}
929 xywh {428 10 112 25} labeltype ENGRAVED_LABEL
932 Fl_Window classify_file_w {
933 label {Classify File}
934 xywh {80 271 1020 515} type Double color 31 hide modal
938 callback {classify_file_w->hide();}
939 xywh {612 454 112 25} labeltype ENGRAVED_LABEL
941 Fl_Input file_title_i {
943 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
945 Fl_Input file_authority_i {
947 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
949 Fl_Input file_description_i {
951 xywh {549 78 447 101} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
953 Fl_Input file_comments_i {
955 xywh {582 220 416 212} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
957 Fl_Output classify_file_to {
958 xywh {0 497 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
960 Fl_Return_Button {} {
962 callback {if (!file_main_slice_b->user_data()) {
963 fl_alert("You have to select Main Slice for file !");
966 if (!file_name_i->size()) {
967 fl_alert("File must have some name !");
970 sfinx_file_t *file = (sfinx_file_t *)classify_file_w->user_data();
971 // file->id(SFINX_FILES_MODULE_CLASSIFY_REQUEST);
972 file->name = file_name_i->value();
973 file->title = file_title_i->value();
974 file->authority = file_authority_i->value();
975 file->description = file_description_i->value();
976 file->comments = file_comments_i->value();
977 file->sorted_location = sorted_location_b->value();
978 file->store_compressed = file_compress_b->value();
979 file->generate_csum = file_gen_csum_b->value();
980 file->main_obj_id = from_voidp(file_main_slice_b->user_data());
981 file->objects.clear();
982 for (int i = 1; i <= file_additional_slices_br->size(); i++) {
983 // file->objects.push_back(from_voidp(file_additional_slices_br->data(i)));
985 app->sfinx.send(file);}
986 xywh {243 454 112 25} labeltype ENGRAVED_LABEL
988 Fl_Check_Button sorted_location_b {
989 label {Sorted Location}
990 xywh {15 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
992 Fl_Check_Button file_crypt_b {
994 xywh {15 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
996 Fl_Check_Button file_compress_b {
997 label {Store compressed}
998 xywh {274 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1001 xywh {13 205 552 227} box ENGRAVED_FRAME
1003 Fl_Button file_main_slice_b {
1004 label {Main Slice (Not Set)}
1005 callback {app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
1006 slices_w->user_data((void *)select_file_main_slice_action);
1008 tooltip {File Main Slice} xywh {45 226 489 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1010 Fl_Browser file_additional_slices_br {
1011 label {Additional Slices}
1012 xywh {26 275 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1014 Fl_Button file_add_slice_b {
1016 callback {app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
1017 slices_w->user_data((void *)select_file_additional_slice_action);
1019 xywh {82 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1021 Fl_Button file_remove_slice_b {
1022 label {Remove Slice}
1023 callback {for (int i = file_additional_slices_br->size(); i >= 1; i--) {
1024 if (file_additional_slices_br->selected(i))
1025 file_additional_slices_br->remove(i);
1027 xywh {358 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1029 Fl_Input file_name_i {
1031 xywh {549 26 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1033 Fl_Check_Button file_gen_csum_b {
1034 label {Generate CSUM}
1035 xywh {274 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1038 Fl_Window search_w {
1040 xywh {169 380 749 389} type Double color 31 hide modal
1044 callback {search_w->hide();}
1045 xywh {182 347 363 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1047 Fl_Return_Button {} {
1049 callback {sfinx_search_query_t query;
1050 query.pattern = search_i->value();
1051 if (search_in_files_b->value())
1052 query.add_area(SFINX_SEARCH_IN_FILES);
1053 // add restrictions ...
1054 app->sfinx.send(query);}
1055 xywh {539 48 163 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1057 Fl_Check_Button search_in_files_b {
1058 label {Search in Files}
1059 xywh {48 96 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
1062 xywh {87 141 561 189} box ROUNDED_FRAME
1064 Fl_Browser search_slices_br {
1065 label {Restrict Search by Slices}
1066 xywh {105 173 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1068 Fl_Button search_add_slice_b {
1070 callback {app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
1071 slices_w->user_data((void *)search_add_slice_action);
1073 xywh {161 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1076 label {Remove Slice}
1077 callback {for (int i = search_slices_br->size(); i >= 1; i--) {
1078 if (search_slices_br->selected(i))
1079 search_slices_br->remove(i);
1081 xywh {437 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1084 label {Search for ...}
1085 xywh {46 47 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1088 Fl_Window search_browser_w {
1089 label {Search Browser}
1090 xywh {217 305 854 476} type Double color 31 hide resizable modal
1094 callback {search_browser_w->hide();}
1095 xywh {638 449 187 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1097 Fl_Browser search_browser_br {
1098 xywh {4 4 846 439} type Hold box GTK_THIN_UP_BOX color 44 resizable
1101 label {Previous Page}
1102 xywh {25 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1106 xywh {231 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1108 Fl_Choice goto_page_ch {
1109 label {Current Page }
1110 xywh {531 450 72 20} box PLASTIC_THIN_UP_BOX down_box PLASTIC_THIN_UP_BOX color 44 labeltype ENGRAVED_LABEL
1114 label {Notes Module}
1115 xywh {83 125 730 370} type Double color 31 hide resizable
1119 callback {notes_w->hide();}
1120 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
1122 Fl_Output notes_module_status_to {
1123 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
1125 Fl_Button new_note_b {
1127 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
1131 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
1133 Fl_Browser notes_br {
1134 callback {if (!Fl::event_clicks())
1137 sfinx_files_vector_t *tree = (sfinx_files_vector_t *) files_module_tree_br->user_data();
1138 int n = files_module_tree_br->value();
1139 //debug("selected %s file", tree->files[n - 1]->url.c_str());
1140 if (tree->files[n - 1]->is_directory) { // ÀÚÅÒ ÓÍÅÎÉÌ ÄÉÒÅËÔÏÒÉÀ
1141 // × file_id ÈÒÁÎÉÔÓÑ id ÔÅËÕÝÅÊ ÄÉÒÅËÔÏÒÉÉ-ÓÌÁÊÓÁ × ËÏÔÏÒÏÊ ÎÁÈÏÄÉÍÓÑ/×ÙÂÒÁÌÉ
1142 // × main_obj_id - parent_id ÄÉÒÅËÔÏÒÉÉ
1143 // ÚÁÈÏÄÉÍ × ÄÉÒÅËÔÏÒÉÀ - ÔÅËÕÝÁÑ ÓÔÁÎÏ×ÉÔÓÑ parent'ÏÍ
1144 current_files_module_tree_path.file_id = tree->files[n - 1]->file_id;
1145 current_files_module_tree_path.main_obj_id = tree->files[n - 1]->main_obj_id;
1146 // × name ÈÒÁÎÉÔÓÑ ×ÅÓØ ÐÕÔØ ÏÔ root location
1147 // × orig_name ÔÏÌØËÏ ÉÍÑ ÔÅËÕÝÅÊ
1148 string t = current_files_module_tree_path.name.c_str();
1149 // current_files_module_tree_path.orig_name = tree->files[n - 1]->name;
1150 t += ('/' + tree->files[n - 1]->name);
1151 current_files_module_tree_path.name = t;
1152 //debug("requesting dir %s", current_files_module_tree_path.c_str());
1153 app->sfinx.send(current_files_module_tree_path);
1155 if (!(tree->files[n - 1]->file_id)) // classify file
1156 classify_file_b->do_callback();
1158 // app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0); // prepare for slice_name() calls
1159 sfinx_file_t *file = tree->files[n - 1];
1160 file->id(SFINX_FILES_MODULE_EDIT_FILE_REQUEST);
1161 app->sfinx.send(file);
1164 xywh {8 45 716 255} type Multi color 31 resizable
1165 code0 {/* static int widths[] = { 10, 450, 200, 200, 0}; */}
1166 code1 {/* files_module_tree_br->column_widths(widths); */}
1170 callback {int n = notes_br->value();
1173 /*sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
1175 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) {
1177 string message = "Deleting \\'" + file->name + "\\'. Are you sure ?";
1178 if (fl_choice(message.c_str(), "Yes", "No", 0L))
1180 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
1181 path += "/" + file->name;
1182 sfinx_string_t f(SFINX_FILES_MODULE_UNLINK);
1186 // sorted can be marked unsorted or deleted
1187 string message = "Delete or Unsort \\'" + file->name + "\\' ?";
1188 int res = fl_choice(message.c_str(), "Cancel", "Unsort", "Delete");
1191 if (res == 2) { // delete
1192 file->id(SFINX_FILES_MODULE_SORTED_UNLINK);
1193 app->sfinx.send(file);
1195 file->id(SFINX_FILES_MODULE_UNSORT);
1196 app->sfinx.send(file);
1199 //files_module_tree_br->remove(n);
1200 app->sfinx.send(current_files_module_tree_path);*/}
1201 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
1205 xywh {35 10 112 25} labeltype ENGRAVED_LABEL
1209 callback {app->sfinx.send(current_note);}
1210 xywh {166 10 112 25} labeltype ENGRAVED_LABEL
1214 callback {for (int i = 1; i <= notes_br->size(); i++)
1215 notes_br->select(i);}
1216 xywh {297 10 112 25} labeltype ENGRAVED_LABEL
1219 label {Unselect All}
1220 callback {notes_br->deselect();}
1221 xywh {428 10 112 25} labeltype ENGRAVED_LABEL
1224 Fl_Window edit_note_w {
1226 xywh {69 302 1020 385} type Double color 31 hide modal
1230 callback {edit_note_w->hide();}
1231 xywh {648 321 112 25} labeltype ENGRAVED_LABEL
1233 Fl_Input note_name_ii {
1235 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1237 Fl_Input note_url_i {
1239 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1241 Fl_Input note_text_i {
1243 xywh {16 141 496 158} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1245 Fl_Output edit_note_to {
1246 xywh {0 364 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
1248 Fl_Return_Button {} {
1250 callback {/*if (!file_main_slice_b->user_data()) {
1251 fl_alert("You have to select Main Slice for file !");
1254 if (!file_name_i->size()) {
1255 fl_alert("File must have some name !");
1258 sfinx_file_t *file = (sfinx_file_t *)classify_file_w->user_data();
1259 // file->id(SFINX_FILES_MODULE_CLASSIFY_REQUEST);
1260 file->name = file_name_i->value();
1261 file->title = file_title_i->value();
1262 file->authority = file_authority_i->value();
1263 file->description = file_description_i->value();
1264 file->comments = file_comments_i->value();
1265 file->sorted_location = sorted_location_b->value();
1266 file->store_compressed = file_compress_b->value();
1267 file->generate_csum = file_gen_csum_b->value();
1268 file->main_obj_id = from_voidp(file_main_slice_b->user_data());
1269 file->objects.clear();
1270 for (int i = 1; i <= file_additional_slices_br->size(); i++) {
1271 // file->objects.push_back(from_voidp(file_additional_slices_br->data(i)));
1273 app->sfinx.send(file);*/}
1274 xywh {279 321 112 25} labeltype ENGRAVED_LABEL
1277 xywh {535 72 467 227} box ENGRAVED_FRAME
1279 Fl_Button note_main_object_b {
1280 label {Main Object Link (Not Set)}
1281 callback {/*app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
1282 slices_w->user_data((void *)select_file_main_slice_action);
1283 slices_w->show();*/}
1284 tooltip {File Main Slice} xywh {594 93 348 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1286 Fl_Browser note_additional_objects_br {
1287 label {Additional Object Tags} selected
1288 xywh {559 146 420 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1290 Fl_Button note_add_object_b {
1292 callback {/*app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
1293 slices_w->user_data((void *)select_file_additional_slice_action);
1294 slices_w->show();*/}
1295 xywh {584 258 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1297 Fl_Button note_remove_object_b {
1299 callback {for (int i = note_additional_objects_br->size(); i >= 1; i--) {
1300 if (note_additional_objects_br->selected(i))
1301 note_additional_objects_br->remove(i);
1303 xywh {811 258 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1305 Fl_Choice note_secured_ch {
1306 label {Secure Level}
1307 xywh {536 27 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
1314 label {Crypted Text}
1320 xywh {357 229 374 154} type Double hide
1324 callback {about_w->hide();}
1325 xywh {72 122 226 20} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1328 image {../docs/sfinx.jpg} xywh {10 9 130 101}
1332 xywh {203 6 99 33} labeltype EMBOSSED_LABEL labelfont 9 labelsize 32
1335 label {Personal knowledge manager}
1336 xywh {150 40 214 22} labeltype EMBOSSED_LABEL labelcolor 64
1339 label {Copyright (C) 2007 Rus V. Brushkoff}
1340 xywh {150 58 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1343 label {Email: Rus@@Sfinx.Od.UA}
1344 xywh {150 75 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1347 label {http://sfinx.od.ua/index.php?id=sfinx}
1348 xywh {150 93 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1351 code {current_slice_id = 1; // root id
1355 Function {x11_ui::log(int level, const char *fmt, ...)} {private return_type void
1357 code {char buf[10240];
1358 const char *level_str;
1363 ::va_start(args, fmt);
1366 case SFINX_LOG_NOTICE:
1367 level_str = "NOTICE";
1369 case SFINX_LOG_WARN:
1372 case SFINX_LOG_ERROR:
1373 level_str = "ERROR";
1375 case SFINX_LOG_FATAL:
1376 level_str = "FATAL";
1379 level_str = "UNKN_LEVEL";
1382 strcpy(buf, level_str);
1384 ::vsnprintf(buf + strlen(level_str) + 2, sizeof(buf) - (strlen(level_str) + 2), fmt, args);
1387 log_m.leaveMutex();} {}
1390 Function {x11_ui::fill_slices_tree(sfinx_slice_vector_t *slices)} {private return_type void
1394 slices_tree->clear();
1395 slices_tree->draw_lines(1);
1396 slices_tree->alternate_color(FL_LIGHT2);
1397 slices_tree->trim_color(FL_LIGHT1);
1398 slices_tree->edit_on_reselect(0);
1399 sfinx_slice_t *slice;
1400 Fl_Toggle_Node *node;
1401 u32_t max_name_len = 0;
1402 for (u32_t i = 0; i < slices->len(); i++) {
1403 slice = slices->get(i);
1404 string name = slice->name() + string(" [ ") +
1405 slice->description() + string(" ] ");
1406 // replace \\n with spaces
1407 string filt_elems( "\\n");
1408 string::size_type pos = 0;
1409 while (( pos = name.find_first_of(filt_elems, pos)) != string::npos)
1410 name.replace(pos, 1, string(" "));
1411 if (name.size() > max_name_len)
1412 max_name_len = name.size();
1413 if (!slice->parent_slice_id) {
1414 node = slices_tree->add_sub((char *)name.c_str());
1415 node->user_data(to_voidp(slice->slice_id));
1417 node = slices_tree->find(to_voidp(slice->parent_slice_id));
1419 slices_tree->open(node);
1420 node = slices_tree->add_sub((char *)name.c_str());
1421 node->user_data(to_voidp(slice->slice_id));
1422 } else F::log("fill slices:",
1423 "can't find node for %d parent, slice_id %d",
1424 slice->parent_slice_id, slice->slice_id);
1427 s32_t width = max_name_len * 8;
1428 // need to count depth for width update
1429 slices_tree->resize(slices_tree->x(), slices_tree->y(), width > slices_tree_scroll->w() ? width : slices_tree_scroll->w(), slices_tree->h());
1430 // try to select previous node
1431 node = slices_tree->find(to_voidp(current_slice_id));
1433 slices_tree->select_range(node, node);
1437 Function {x11_ui::fill_select_slice_tree(sfinx_slice_vector_t *slices)} {private return_type void
1441 select_slice_tree->clear();
1442 select_slice_tree->draw_lines(1);
1443 select_slice_tree->alternate_color(FL_LIGHT2);
1444 select_slice_tree->trim_color(FL_LIGHT1);
1445 select_slice_tree->edit_on_reselect(0);
1446 sfinx_slice_t *slice;
1447 Fl_Toggle_Node *node;
1448 u32_t max_name_len = 0;
1449 for (u32_t i = 0; i < slices->len(); i++) {
1450 slice = slices->get(i);
1451 string name = slice->name() + string(" [ ") +
1452 slice->description() + string(" ] ");
1453 // replace \\n with spaces
1454 string filt_elems( "\\n");
1455 string::size_type pos = 0;
1456 while (( pos = name.find_first_of(filt_elems, pos)) != string::npos)
1457 name.replace(pos, 1, string(" "));
1458 if (name.size() > max_name_len)
1459 max_name_len = name.size();
1460 if (!slice->parent_slice_id) {
1461 node = select_slice_tree->add_sub((char *)name.c_str());
1462 node->user_data(to_voidp(slice->slice_id));
1464 node = select_slice_tree->find(to_voidp(slice->parent_slice_id));
1466 select_slice_tree->open(node);
1467 node = select_slice_tree->add_sub((char *)name.c_str());
1468 node->user_data(to_voidp(slice->slice_id));
1469 } // else node is not connected - just ignore
1472 s32_t width = max_name_len * 8;
1473 // need to count depth for width update
1474 select_slice_tree->resize(select_slice_tree->x(), select_slice_tree->y(),
1475 width > select_slice_tree_scroll->w() ? width : select_slice_tree_scroll->w(), select_slice_tree->h());
1479 Function {x11_ui::edit_slice(sfinx_slice_t *slice)} {private return_type void
1483 slice_name_i->value(slice->name());
1484 slice_directory_i->value(slice->directory());
1485 slice_name_i->take_focus();
1486 slice_description_i->value(slice->description());
1487 string status_line = "Parent slice: ";
1488 status_line += slice->parent_name();
1489 int cyear, cmonth, cday, eyear, emonth, eday, chour, cmin, csec, ehour, emin, esec;
1490 slice->ctime.GetDate(cyear, cmonth, cday);
1491 slice->etime.GetDate(eyear, emonth, eday);
1492 slice->ctime.GetTime(chour, cmin, csec);
1493 slice->etime.GetTime(ehour, emin, esec);
1495 sprintf(buf, " | Created at %02d/%02d/%02d %02d:%02d:%02d, Modified at %02d/%02d/%02d %02d:%02d:%02d", cyear, cmonth, cday, chour, cmin,
1496 csec, eyear, emonth, eday, ehour, emin, esec);
1498 edit_slice_to->value(status_line.c_str());
1499 edit_slice_w->show();
1503 Function {x11_ui::fill_preferences()} {private return_type void
1507 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, t);
1508 config_files_module_unsorted_path_i->value(t.c_str());
1509 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, t);
1510 config_files_module_sorted_path_i->value(t.c_str());
1511 app->files_module_conf.get(FILES_MODULE_DESC_FILE_NAME, t);
1512 config_files_module_desc_file_name_i->value(t.c_str());
1513 u32_t gen_desc_files;
1514 app->files_module_conf.get(FILES_MODULE_DESC_FILE_ENABLE, &gen_desc_files);
1515 gen_desc_files_b->value(gen_desc_files);
1519 Function {x11_ui::fill_files_module_tree(sfinx_files_vector_t *tree_)} {private return_type void
1522 static sfinx_files_vector_t tree;
1524 files_module_tree_br->user_data((void *)&tree);
1525 files_module_tree_br->clear();
1527 u32_t files = 0, dirs = 0;
1528 // set parent dir id
1529 if (tree.files.size())
1530 current_files_module_tree_path.main_obj_id = tree.files[0]->compressed_fsize;
1531 for (u32_t i = 0; i < tree.files.size(); i++) {
1532 if (tree.files[i]->is_directory)
1533 strcpy(buf, "\\t@b@.");
1536 strncat(buf, tree.files[i]->name.c_str(), 50);
1538 if (tree.files[i]->is_directory) {
1539 strcpy(dir_len, "\\t@b@.< DIR >\\t");
1542 sprintf(dir_len, "\\t%llu\\t", tree.files[i]->fsize);
1545 strcat(buf, dir_len);
1546 int cyear, cmonth, cday, chour, cmin, csec;
1547 tree.files[i]->ctime.GetDate(cyear, cmonth, cday);
1548 tree.files[i]->ctime.GetTime(chour, cmin, csec);
1549 sprintf(dir_len, "%02d/%02d/%04d %02d:%02d:%02d\\t", cday, cmonth, cyear, chour, cmin, csec);
1550 strcat(buf, dir_len);
1551 strcat(buf, tree.files[i]->mimetype.c_str());
1552 files_module_tree_br->add(buf);
1554 files_module_tree_br->redraw();
1556 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
1557 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, root);
1559 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, root);
1560 sprintf(buf, "Path: %s | Total %d file%s and %d director%s", (root + current_files_module_tree_path.name.c_str()).c_str(), files, (files == 1) ? "" : "s", dirs,
1561 (dirs == 1) ? "y" : "ies");
1562 files_module_status_to->value(buf);
1563 files_module_status_to->redraw();
1567 Function {x11_ui::files_module_classify_reply(sfinx_string_t *classify_error)} {private return_type void
1570 if (classify_error->size() == 1) {
1571 classify_file_w->hide();
1572 app->sfinx.send(current_files_module_tree_path);
1573 // files_module_tree_br->remove(files_module_tree_br->value());
1575 fl_alert(classify_error->c_str());
1579 Function {x11_ui::progress(sfinx_progress_t *p)} {private return_type void
1582 static char buf[128];
1583 switch (p->status()) {
1584 case SFINX_PROGRESS_START:
1585 progress_l->label(p->label());
1586 strcpy(buf, p->strvalue());
1587 progress_bar->label(buf);
1588 progress_bar->minimum(0);
1589 progress_bar->maximum(p->max());
1590 progress_bar->value(p->value());
1592 progress_w->redraw();
1594 case SFINX_PROGRESS_END:
1597 case SFINX_PROGRESS_NONE:
1604 Function {x11_ui::alert(sfinx_string_t *alert)} {private return_type void
1607 if (alert->size() != 1)
1608 fl_alert(alert->c_str());
1612 Function {x11_ui::files_module_edit(sfinx_file_t *f)} {private return_type void
1615 static sfinx_file_t file;
1618 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
1619 file.etime.GetDate(eyear, emonth, eday);
1620 file.etime.GetTime(ehour, emin, esec);
1621 file.ctime.GetDate(cyear, cmonth, cday);
1622 file.ctime.GetTime(chour, cmin, csec);
1623 sprintf(buf, "%llu bytes | Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", file.fsize, cday, cmonth, cyear,
1624 chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
1626 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
1627 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
1629 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, path);
1630 string t = "URL: " + path + current_files_module_tree_path.name + "/" + file.name + " | " + file.mimetype + " | Size: " + buf;
1631 classify_file_to->value(t.c_str());
1632 file_title_i->value(file.title.c_str());
1633 file_name_i->value(file.name.c_str());
1634 // save orig file name
1635 file.orig_name = file.name;
1636 file.id(SFINX_FILES_MODULE_EDIT_FILE); // edit file
1637 file_title_i->take_focus();
1638 file_authority_i->value(file.authority.c_str());
1639 file_description_i->value(file.description.c_str());
1640 file_comments_i->value(file.comments.c_str());
1641 sorted_location_b->value(file.sorted_location);
1642 file_compress_b->value(file.store_compressed);
1643 file_gen_csum_b->value(file.generate_csum);
1644 static string main_slice_name;
1645 main_slice_name = app->slice_name(file.main_obj_id);
1646 file_main_slice_b->label(main_slice_name.c_str());
1647 file_main_slice_b->user_data(to_voidp(file.main_obj_id)); // ÔÕÔÁ ÈÒÁÎÉÔÓÑ main_slice_id
1648 file_additional_slices_br->clear();
1649 //for (u32_t i = 0; i < file.objects.size(); i++)
1650 // file_additional_slices_br->add((app->slice_name(file.objects[i]).c_str()), to_voidp(file.objects[i]));
1651 classify_file_w->user_data((void *)&file);
1652 classify_file_w->show();
1656 Function {x11_ui::files_module_edit_reply(sfinx_string_t *classify_error)} {private return_type void
1659 if (classify_error->size() == 1) {
1660 app->sfinx.send(current_files_module_tree_path);
1661 classify_file_w->hide();
1663 fl_alert(classify_error->c_str());
1667 Function {x11_ui::search_browser(sfinx_pair_vector_t *r)} {private return_type void
1670 search_browser_br->clear();
1672 search_browser_br->add("Sfinx has no data for this query");
1675 goto_page_ch->clear();
1676 /*for (u32_t i = 1; i < 50; i++) {
1678 sprintf(b, "%d", i);
1679 goto_page_ch->add(b, 0, 0, (void *)i);
1680 // Fl_Menu_Item *item = (Fl_Menu_Item *)(goto_page_ch->menu() + n);
1681 // item->color(FL_GREEN);
1683 goto_page_ch->value(0);
1684 //goto_page_ch->selection_color(FL_GREEN);
1687 for (u32_t i = 0; i < r->len(); i++) {
1688 sfinx_pair_t *p = r->find(i);
1692 if (!p->get(i, &el))
1696 prepare_search_info(el, inf);
1697 string::size_type pos = 0, found;
1698 while ((found = inf.find('\\n', pos)) != string::npos) {
1699 string line(inf, pos, found - pos);
1700 search_browser_br->add(line.c_str());
1703 search_browser_br->add("@-");
1706 search_browser_w->show();
1710 Function {x11_ui::prepare_search_info(sfinx_t *el, string &inf)} {private return_type void
1712 code {sfinx_file_t *f;
1714 case SFINX_ELEMENT_FILE:
1715 f = (sfinx_file_t *)el;
1716 inf = "\\nType: File\\n";
1717 inf.append("Slice Hierarchy: " + app->slice_hierarchy(f->main_obj_id) + "\\n");
1718 /* if (f->slices.size()) {
1719 inf.append("Additional Slices : ");
1720 for (u32_t i = 0; i < f->slices.size(); i++) {
1723 inf.append(app->slice_name(f->slices[i]));
1727 inf.append("Title: " + f->title + "\\n");
1728 inf.append("Authority: " + f->authority + "\\n");
1729 inf.append("Description: " + f->description + "\\n");
1730 inf.append("Comments: " + f->comments + "\\n");
1731 inf.append("Name: " + f->name + "\\n");
1733 sprintf(buf, "%llu bytes\\n", f->fsize);
1734 inf.append("Size: ");
1737 inf.append("Csum: " + f->csum + "\\n");
1738 sprintf(buf, "%llu bytes\\n", f->compressed_fsize);
1739 inf.append("Compressed Size: ");
1741 if (f->compressed_csum.size())
1742 inf.append("Compressed Csum: " + f->compressed_csum + "\\n");
1743 int year, month, day, hour, min, sec;
1744 f->ctime.GetDate(year, month, day);
1745 f->ctime.GetTime(hour, min, sec);
1746 sprintf(buf, "Create Entry Time: %02d/%02d/%04d %02d:%02d:%02d\\n", day, month, year, hour, min, sec);
1748 f->etime.GetDate(year, month, day);
1749 f->etime.GetTime(hour, min, sec);
1750 sprintf(buf, "Edit Entry Time: %02d/%02d/%04d %02d:%02d:%02d\\n", day, month, year, hour, min, sec);
1755 debug("Can't fill element info !");