# data file for the Fltk User Interface Designer (fluid)
version 1.0105 
header_name {.h} 
code_name {.cc}
decl {\#include <FL/fl_ask.H>} {public
} 

decl {\#include <stdio.h>} {public
} 

decl {\#include <stdlib.h>} {public
} 

decl {\#include "../Params/Presets.h"} {public
} 

class PresetsUI_ {} {
  Function {refresh()} {open return_type {virtual void}
  } {}
  Function {~PresetsUI_()} {open return_type virtual
  } {}
} 

class PresetsUI {} {
  Function {PresetsUI()} {} {
    code {p=NULL;
make_window();} {}
  }
  Function {~PresetsUI()} {} {
    code {copywin->hide();delete(copywin);
pastewin->hide();delete(pastewin);} {}
  }
  Function {make_window()} {} {
    Fl_Window copywin {
      label {Copy to Clipboard/Preset}
      xywh {190 173 265 430} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal
    } {
      Fl_Browser copybrowse {
        callback {int val=o->value();
if (val!=0){
   presetname->cut(0,presetname->maximum_size());
   presetname->insert(o->text(val));
};}
        xywh {10 25 245 320} type Select
      }
      Fl_Button copypbutton {
        label {Copy to Preset}
        callback {const char *tmp=presetname->value();
if (tmp!=NULL) {
        if (strlen(tmp)>0){
           p->copy(tmp);
	   copywin->hide();
        };
};}
        xywh {145 355 110 20} box THIN_UP_BOX
      }
      Fl_Button copybutton {
        label {Copy to Clipboard}
        callback {p->copy(NULL);
copywin->hide();}
        xywh {25 385 90 35} box THIN_UP_BOX align 192
      }
      Fl_Button {} {
        label Cancel
        callback {copywin->hide();}
        xywh {160 385 80 35} box THIN_UP_BOX align 192
      }
      Fl_Box {} {
        label {Type:}
        xywh {10 5 40 15} labelsize 12 align 20
      }
      Fl_Box copytypetext {
        xywh {50 5 205 15} box FLAT_BOX color 238 labelfont 1 labelsize 12 align 20
      }
      Fl_Input presetname {
        callback {const char *tmp=o->value();
if (tmp==NULL) tmp="";
if (strlen(tmp)>0) {
	copybutton->deactivate();
	copypbutton->activate();
} else {
	copybutton->activate();
	copypbutton->deactivate();
};}
        xywh {10 355 130 20} when 1
      }
    }
    Fl_Window pastewin {
      label {Paste from Clipboard/Preset}
      xywh {463 173 265 430} type Double box PLASTIC_THIN_UP_BOX color 238 hide modal
    } {
      Fl_Browser pastebrowse {
        callback {if (o->value()==0) {
	pastepbutton->deactivate();
	deletepbutton->deactivate();
}else{
	pastepbutton->activate();
	deletepbutton->activate();
};} selected
        xywh {10 25 245 320} type Hold
      }
      Fl_Button pastepbutton {
        label {Paste from Preset}
        callback {int n=pastebrowse->value();
if (n!=0) p->paste(n);
pastewin->hide();
pui->refresh();}
        xywh {10 355 160 20} box THIN_UP_BOX
      }
      Fl_Button pastebutton {
        label {Paste from Clipboard}
        callback {p->paste(0);
pastewin->hide();
pui->refresh();}
        xywh {25 385 90 35} box THIN_UP_BOX align 192
      }
      Fl_Button {} {
        label Cancel
        callback {pastewin->hide();}
        xywh {160 385 80 35} box THIN_UP_BOX align 192
      }
      Fl_Box pastetypetext {
        xywh {55 5 200 15} box FLAT_BOX color 238 labelfont 1 labelsize 12 align 20
      }
      Fl_Box {} {
        label {Type:}
        xywh {15 5 40 15} labelsize 12 align 20
      }
      Fl_Button deletepbutton {
        label Delete
        callback {int n=pastebrowse->value();
if (n!=0) p->deletepreset(n);
rescan();}
        xywh {180 355 75 20} box THIN_UP_BOX
      }
    }
  }
  Function {copy(Presets *p)} {} {
    code {copybutton->activate();
copypbutton->deactivate();


this->p=p;
this->pui=NULL;
bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
presetname->cut(0,presetname->maximum_size());

if (but) p->copy(NULL);
   else {
        rescan();
	copytypetext->label(&p->type[1]);
	copywin->show();
   };} {}
  }
  Function {paste(Presets *p,PresetsUI_ *pui)} {} {
    code {this->p=p;
this->pui=pui;
bool but=(Fl::event_button()!=FL_LEFT_MOUSE);
pastepbutton->deactivate();
deletepbutton->deactivate();

if (but) {
	p->paste(0);
	pui->refresh();
} else {
        rescan();
	pastetypetext->label(&p->type[1]);
	if (p->checkclipboardtype()) pastebutton->activate();
		else pastebutton->deactivate();
	pastewin->show();
   };} {}
  }
  Function {copy(Presets *p,int n)} {} {
    code {p->setelement(n);
copy(p);} {}
  }
  Function {paste(Presets *p,PresetsUI_ *pui,int n)} {} {
    code {p->setelement(n);
paste(p,pui);} {}
  }
  Function {rescan()} {} {
    code {copybrowse->clear();
pastebrowse->clear();
p->rescanforpresets();

for (int i=0;i<MAX_PRESETS;i++){
   char *name=presetsstore.presets[i].name;
   if (name==NULL) break;
   copybrowse->add(name);
   pastebrowse->add(name);
};} {}
  }
  decl {Presets *p;} {public
  }
  decl {PresetsUI_ *pui;} {public
  }
} 

decl {PresetsUI *presetsui;} {public
}