Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
4.0KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 1.0110
  3. header_name {.H}
  4. code_name {.C}
  5. comment {//
  6. // Copyright (C) 2008 Jonathan Moore Liles
  7. //
  8. // This program is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU General Public License
  10. // as published by the Free Software Foundation; either version 2
  11. // of the License, or (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. //
  22. } {in_source in_header
  23. }
  24. decl {\#include <stdlib.h>} {}
  25. decl {\#include <string.h>} {}
  26. decl {\#include <stdio.h>} {}
  27. decl {\#include <FL/Fl_File_Chooser.H>} {}
  28. class New_Project_Dialog {open
  29. } {
  30. Function {New_Project_Dialog()} {open
  31. } {
  32. code {_default_path = 0;
  33. path = 0;
  34. make_window();} {}
  35. }
  36. Function {run()} {open return_type void
  37. } {
  38. code {
  39. _directory->value( _default_path );
  40. _window->show();
  41. while ( _window->shown() )
  42. Fl::wait();} {}
  43. }
  44. Function {make_window()} {open
  45. } {
  46. Fl_Window _window {
  47. label {New Project} open
  48. xywh {406 251 550 195} type Double hide modal xclass Non_DAW
  49. } {
  50. Fl_File_Input _name {
  51. label {Named:}
  52. xywh {75 140 375 35}
  53. }
  54. Fl_Button {} {
  55. label Browse
  56. callback {_directory->value( fl_dir_chooser( "Directory for new project", NULL, 0 ) );}
  57. xywh {455 100 80 35}
  58. }
  59. Fl_Return_Button {} {
  60. label Create
  61. callback {if ( strlen( _directory->value() ) && strlen( _name->value() ) )
  62. {
  63. char pat[1024];
  64. snprintf( pat, sizeof( pat ), "%s/%s", _directory->value(), _name->value() );
  65. path = strdup( pat );
  66. _default_path = _directory->value() ? strdup( _directory->value() ) : 0;
  67. //if ( ! Project::create( pat, _template->text( _template->value() ) ) )
  68. // fl_alert( "Error creating project!" );
  69. _window->hide();
  70. }}
  71. xywh {455 140 80 35}
  72. }
  73. Fl_File_Input _directory {
  74. label {Where:}
  75. callback {if ( ! fl_filename_isdir( o->value() ) )
  76. {
  77. fl_alert( "Must be a directory" );
  78. o->value( "" );
  79. return;
  80. }
  81. // write_line( user_config_dir, "default_path", o->value() );}
  82. xywh {75 100 375 35}
  83. code0 {\#include <FL/filename.H>}
  84. code1 {char *v;}
  85. code2 {// read_line( user_config_dir, "default_path", &v );}
  86. code3 {o->value( v );}
  87. }
  88. Fl_Box {} {
  89. label {New Project}
  90. xywh {15 8 520 33} box RSHADOW_BOX color 133 labelsize 20 labelcolor 32
  91. }
  92. Fl_Choice _template {
  93. label {Template:} open
  94. private xywh {310 60 225 25} down_box BORDER_BOX
  95. } {
  96. MenuItem {} {
  97. label Default
  98. xywh {0 0 40 25}
  99. }
  100. }
  101. }
  102. }
  103. decl {char *path;} {public
  104. }
  105. decl {char *_default_path} {}
  106. Function {templates( const char **templates )} {open return_type void
  107. } {
  108. code {for ( const char **s = templates; *s; ++s )
  109. _template->add( *s );} {}
  110. }
  111. Function {default_path( char *s )} {open return_type void
  112. } {
  113. code {_default_path = s;} {}
  114. }
  115. Function {default_path()} {open return_type {char *}
  116. } {
  117. code {return _default_path;} {}
  118. }
  119. Function {selected_template()} {open return_type {const char *}
  120. } {
  121. code {return _template->text( _template->value() );} {}
  122. }
  123. }
  124. Function {new_project_chooser( const char **templates, char **default_path, char **selected_template )} {open C return_type {char*}
  125. } {
  126. code {New_Project_Dialog nsd;
  127. nsd.templates( templates );
  128. nsd.default_path( *default_path );
  129. nsd.run();
  130. *default_path = strdup( nsd.default_path() );
  131. *selected_template = strdup( nsd.selected_template() );
  132. return nsd.path;} {selected
  133. }
  134. }