Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
void NrmDlg::create_dlg()
{
	Fl_Menu_Item k[]={{"x"}, {"y"}, { "z"}, {0}};
	wnd = new Fl_Double_Window(135, 215);
	min = new Fl_Value_Input(10, 25, 115, 25, mgl_gettext("Minimal value (v1)"));
	min->align(FL_ALIGN_TOP_LEFT);
	min->tooltip(mgl_gettext("Minimal value for resulting data values"));
	max = new Fl_Value_Input(10, 70, 115, 25, mgl_gettext("Maximal value (v2)"));
	max->align(FL_ALIGN_TOP_LEFT);
	max->tooltip(mgl_gettext("Maximal value for resulting data values"));
	dir = new Fl_Choice(10, 115, 115, 25, mgl_gettext("Direction"));
	dir->align(FL_ALIGN_TOP_LEFT);	dir->copy(k);
	dir->tooltip(mgl_gettext("Direction along which data will be filled"));
	sym = new Fl_Check_Button(10, 115, 115, 25, mgl_gettext("Symetrical range"));
	sym->tooltip(mgl_gettext("Normalize in symmetrical range: -max(|v1|,|v2|) ... max(|v1|,|v2|)"));

	Fl_Button *o;
	o = new Fl_Button(25, 150, 85, 25, mgl_gettext("Cancel"));	o->callback(close_dlg_cb,wnd);
	o->box(UDAV_UP_BOX);	o->down_box(UDAV_DOWN_BOX);
	o->tooltip(mgl_gettext("Do nothing and close this window"));
	o = new Fl_Return_Button(25, 180, 85, 25, mgl_gettext("Change"));o->callback(nrm_dlg_cb,wnd);
	o->box(UDAV_UP_BOX);	o->down_box(UDAV_DOWN_BOX);
	o->tooltip(mgl_gettext("Change data values and close this window"));
	wnd->end();
}
Ejemplo n.º 2
0
Fl_Double_Window* FilterUI::make_formant_window() {
  { formantparswindow = new Fl_Double_Window(700, 205, "Formant Filter Parameters");
    formantparswindow->user_data((void*)(this));
    { Fl_Group* o = new Fl_Group(485, 47, 105, 113);
      o->box(FL_THIN_UP_BOX);
      { Fl_Counter* o = new Fl_Counter(545, 80, 40, 15, "Formant ");
        o->type(1);
        o->labelfont(1);
        o->labelsize(10);
        o->minimum(0);
        o->maximum(127);
        o->step(1);
        o->textsize(10);
        o->callback((Fl_Callback*)cb_Formant);
        o->align(FL_ALIGN_LEFT);
        o->bounds(0,FF_MAX_FORMANTS-1);
        o->value(nformant);
      } // Fl_Counter* o
      { Fl_Counter* o = new Fl_Counter(545, 55, 40, 20, "Vowel no.");
        o->type(1);
        o->labelfont(1);
        o->labelsize(10);
        o->minimum(0);
        o->maximum(127);
        o->step(1);
        o->textfont(1);
        o->textsize(11);
        o->callback((Fl_Callback*)cb_Vowel);
        o->align(FL_ALIGN_LEFT);
        o->bounds(0,FF_MAX_VOWELS-1);
        o->value(nvowel);
      } // Fl_Counter* o
      { formantparsgroup = new Fl_Group(490, 105, 95, 50);
        formantparsgroup->box(FL_ENGRAVED_FRAME);
        { formant_freq_dial = new WidgetPDial(495, 115, 25, 25, "freq");
          formant_freq_dial->tooltip("Formant frequency");
          formant_freq_dial->box(FL_ROUND_UP_BOX);
          formant_freq_dial->color(FL_BACKGROUND_COLOR);
          formant_freq_dial->selection_color(FL_INACTIVE_COLOR);
          formant_freq_dial->labeltype(FL_NORMAL_LABEL);
          formant_freq_dial->labelfont(0);
          formant_freq_dial->labelsize(10);
          formant_freq_dial->labelcolor(FL_FOREGROUND_COLOR);
          formant_freq_dial->maximum(127);
          formant_freq_dial->step(1);
          formant_freq_dial->callback((Fl_Callback*)cb_formant_freq_dial);
          formant_freq_dial->align(FL_ALIGN_BOTTOM);
          formant_freq_dial->when(FL_WHEN_CHANGED);
        } // WidgetPDial* formant_freq_dial
        { formant_q_dial = new WidgetPDial(525, 115, 24, 25, "Q");
          formant_q_dial->tooltip("Formant\'s Q");
          formant_q_dial->box(FL_ROUND_UP_BOX);
          formant_q_dial->color(FL_BACKGROUND_COLOR);
          formant_q_dial->selection_color(FL_INACTIVE_COLOR);
          formant_q_dial->labeltype(FL_NORMAL_LABEL);
          formant_q_dial->labelfont(0);
          formant_q_dial->labelsize(10);
          formant_q_dial->labelcolor(FL_FOREGROUND_COLOR);
          formant_q_dial->maximum(127);
          formant_q_dial->step(1);
          formant_q_dial->callback((Fl_Callback*)cb_formant_q_dial);
          formant_q_dial->align(FL_ALIGN_BOTTOM);
          formant_q_dial->when(FL_WHEN_CHANGED);
        } // WidgetPDial* formant_q_dial
        { formant_amp_dial = new WidgetPDial(555, 115, 24, 25, "amp");
          formant_amp_dial->tooltip("Formant amplitude");
          formant_amp_dial->box(FL_ROUND_UP_BOX);
          formant_amp_dial->color(FL_BACKGROUND_COLOR);
          formant_amp_dial->selection_color(FL_INACTIVE_COLOR);
          formant_amp_dial->labeltype(FL_NORMAL_LABEL);
          formant_amp_dial->labelfont(0);
          formant_amp_dial->labelsize(10);
          formant_amp_dial->labelcolor(FL_FOREGROUND_COLOR);
          formant_amp_dial->maximum(127);
          formant_amp_dial->step(1);
          formant_amp_dial->callback((Fl_Callback*)cb_formant_amp_dial);
          formant_amp_dial->align(FL_ALIGN_BOTTOM);
          formant_amp_dial->when(FL_WHEN_CHANGED);
        } // WidgetPDial* formant_amp_dial
        formantparsgroup->end();
      } // Fl_Group* formantparsgroup
      o->end();
    } // Fl_Group* o
    { Fl_Group* o = new Fl_Group(590, 47, 100, 113);
      o->box(FL_THIN_UP_BOX);
      { Fl_Counter* o = new Fl_Counter(595, 62, 55, 20, "Seq.Size");
        o->type(1);
        o->labelfont(1);
        o->labelsize(10);
        o->minimum(0);
        o->maximum(127);
        o->step(1);
        o->textfont(1);
        o->textsize(11);
        o->callback((Fl_Callback*)cb_Seq);
        o->align(FL_ALIGN_TOP_LEFT);
        o->bounds(1,FF_MAX_SEQUENCE-1);
        o->value(pars->Psequencesize);
      } // Fl_Counter* o
      { Fl_Counter* o = new Fl_Counter(595, 97, 40, 15, "S.Pos.");
        o->tooltip("Current position from the sequence");
        o->type(1);
        o->labelfont(1);
        o->labelsize(10);
        o->minimum(0);
        o->maximum(127);
        o->step(1);
        o->textsize(10);
        o->callback((Fl_Callback*)cb_S);
        o->align(FL_ALIGN_TOP_RIGHT);
        o->bounds(0,FF_MAX_SEQUENCE-2);
        o->value(nseqpos);
      } // Fl_Counter* o
      { Fl_Counter* o = vowel_counter = new Fl_Counter(640, 97, 40, 15, "Vowel");
        vowel_counter->type(1);
        vowel_counter->labelsize(10);
        vowel_counter->minimum(0);
        vowel_counter->maximum(127);
        vowel_counter->step(1);
        vowel_counter->textsize(10);
        vowel_counter->callback((Fl_Callback*)cb_vowel_counter);
        vowel_counter->align(FL_ALIGN_TOP);
        o->bounds(0,FF_MAX_VOWELS-1);
      } // Fl_Counter* vowel_counter
      { Fl_Check_Button* o = new Fl_Check_Button(625, 132, 60, 20, "Neg.Input");
        o->tooltip("Negate the input from LFO/envelopes/etc.");
        o->down_box(FL_DOWN_BOX);
        o->labelsize(10);
        o->callback((Fl_Callback*)cb_Neg);
        o->value(pars->Psequencereversed);
      } // Fl_Check_Button* o
      { WidgetPDial* o = strchdial = new WidgetPDial(595, 130, 25, 25, "Strch");
        strchdial->tooltip("Sequence Stretch");
        strchdial->box(FL_ROUND_UP_BOX);
        strchdial->color(FL_BACKGROUND_COLOR);
        strchdial->selection_color(FL_INACTIVE_COLOR);
        strchdial->labeltype(FL_NORMAL_LABEL);
        strchdial->labelfont(0);
        strchdial->labelsize(10);
        strchdial->labelcolor(FL_FOREGROUND_COLOR);
        strchdial->maximum(127);
        strchdial->step(1);
        strchdial->callback((Fl_Callback*)cb_strchdial);
        strchdial->align(FL_ALIGN_TOP);
        strchdial->when(FL_WHEN_CHANGED);
        o->value(pars->Psequencestretch);
      } // WidgetPDial* strchdial
      o->end();
    } // Fl_Group* o
    { Fl_Counter* o = new Fl_Counter(485, 15, 65, 20, "Num.Formants");
      o->type(1);
      o->labelfont(1);
      o->labelsize(10);
      o->minimum(0);
      o->maximum(127);
      o->step(1);
      o->callback((Fl_Callback*)cb_Num);
      o->align(FL_ALIGN_TOP_LEFT);
      o->bounds(1,FF_MAX_FORMANTS);
      o->value(pars->Pnumformants);
    } // Fl_Counter* o
    { WidgetPDial* o = frsldial = new WidgetPDial(565, 15, 25, 25, "Fr.Sl.");
      frsldial->tooltip("Formant\'s Slowness (Morphing)");
      frsldial->box(FL_ROUND_UP_BOX);
      frsldial->color(FL_BACKGROUND_COLOR);
      frsldial->selection_color(FL_INACTIVE_COLOR);
      frsldial->labeltype(FL_NORMAL_LABEL);
      frsldial->labelfont(1);
      frsldial->labelsize(10);
      frsldial->labelcolor(FL_FOREGROUND_COLOR);
      frsldial->maximum(127);
      frsldial->step(1);
      frsldial->callback((Fl_Callback*)cb_frsldial);
      frsldial->align(FL_ALIGN_TOP);
      frsldial->when(FL_WHEN_CHANGED);
      o->value(pars->Pformantslowness);
    } // WidgetPDial* frsldial
    { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(515, 164, 33, 18, "C.f.");
      centerfreqvo->tooltip("Center Frequency (kHz)");
      centerfreqvo->minimum(1);
      centerfreqvo->maximum(10);
      centerfreqvo->step(0.01);
      centerfreqvo->value(1);
      centerfreqvo->textfont(1);
      centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo);
      centerfreqvo->when(3);
      o->value(pars->getcenterfreq()/1000.0);
    } // Fl_Value_Output* centerfreqvo
    { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(515, 182, 33, 18, "Oct.");
      octavesfreqvo->tooltip("No. of octaves");
      octavesfreqvo->minimum(1);
      octavesfreqvo->maximum(127);
      octavesfreqvo->step(1);
      octavesfreqvo->value(5);
      octavesfreqvo->textfont(1);
      octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo);
      octavesfreqvo->when(3);
      o->value(pars->getoctavesfreq());
    } // Fl_Value_Output* octavesfreqvo
    { Fl_Slider* o = cfknob = new Fl_Slider(551, 167, 84, 15);
      cfknob->type(5);
      cfknob->box(FL_FLAT_BOX);
      cfknob->maximum(127);
      cfknob->callback((Fl_Callback*)cb_cfknob);
      o->value(pars->Pcenterfreq);
    } // Fl_Slider* cfknob
    { Fl_Slider* o = octknob = new Fl_Slider(551, 185, 84, 15);
      octknob->type(5);
      octknob->box(FL_FLAT_BOX);
      octknob->maximum(127);
      octknob->callback((Fl_Callback*)cb_octknob);
      o->value(pars->Poctavesfreq);
    } // Fl_Slider* octknob
    { FormantFilterGraph* o = formantfiltergraph = new FormantFilterGraph(5, 5, 475, 195);
      formantfiltergraph->box(FL_BORDER_BOX);
      formantfiltergraph->color(FL_BACKGROUND_COLOR);
      formantfiltergraph->selection_color(FL_BACKGROUND_COLOR);
      formantfiltergraph->labeltype(FL_NORMAL_LABEL);
      formantfiltergraph->labelfont(0);
      formantfiltergraph->labelsize(14);
      formantfiltergraph->labelcolor(FL_FOREGROUND_COLOR);
      formantfiltergraph->align(FL_ALIGN_CENTER);
      formantfiltergraph->when(FL_WHEN_RELEASE);
      o->init(pars,&nvowel,&nformant);
    } // FormantFilterGraph* formantfiltergraph
    { WidgetPDial* o = wvknob = new WidgetPDial(600, 15, 25, 25, "Vw.Cl.");
      wvknob->tooltip("Vowel \"clearness\" (how the mixed vowels are avoided)");
      wvknob->box(FL_ROUND_UP_BOX);
      wvknob->color(FL_BACKGROUND_COLOR);
      wvknob->selection_color(FL_INACTIVE_COLOR);
      wvknob->labeltype(FL_NORMAL_LABEL);
      wvknob->labelfont(1);
      wvknob->labelsize(10);
      wvknob->labelcolor(FL_FOREGROUND_COLOR);
      wvknob->maximum(127);
      wvknob->step(1);
      wvknob->callback((Fl_Callback*)cb_wvknob);
      wvknob->align(FL_ALIGN_TOP);
      wvknob->when(FL_WHEN_CHANGED);
      o->value(pars->Pvowelclearness);
    } // WidgetPDial* wvknob
    { Fl_Button* o = new Fl_Button(645, 180, 50, 25, "Close");
      o->box(FL_THIN_UP_BOX);
      o->callback((Fl_Callback*)cb_Close);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(635, 25, 25, 15, "C");
      o->box(FL_THIN_UP_BOX);
      o->color((Fl_Color)179);
      o->labelfont(1);
      o->labelsize(11);
      o->labelcolor(FL_BACKGROUND2_COLOR);
      o->callback((Fl_Callback*)cb_C1);
    } // Fl_Button* o
    { Fl_Button* o = new Fl_Button(665, 25, 25, 15, "P");
      o->box(FL_THIN_UP_BOX);
      o->color((Fl_Color)179);
      o->labelfont(1);
      o->labelsize(11);
      o->labelcolor(FL_BACKGROUND2_COLOR);
      o->callback((Fl_Callback*)cb_P1);
    } // Fl_Button* o
    { new Fl_Box(635, 10, 55, 15, "Vowel");
    } // Fl_Box* o
    formantparswindow->end();
  } // Fl_Double_Window* formantparswindow
  return formantparswindow;
}
Ejemplo n.º 3
0
Fl_Double_Window* make_window() {
  Fl_Double_Window* w;
   {Fl_Double_Window* o = new Fl_Double_Window(560, 489);
    w = o;
    o->type(241);
     {Fl_Box* o = imbox = new Fl_Box(5, 30, 385, 455);
      o->box(FL_ENGRAVED_BOX);
      o->align(FL_ALIGN_CLIP);
      Fl_Group::current()->resizable(o);
    }
     {Fl_Box* o = filename_box = new Fl_Box(5, 5, 385, 20, "No file loaded...");
      o->box(FL_THIN_DOWN_BOX);
      o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
    }
     {Fl_Group* o = new Fl_Group(395, 5, 160, 480);
      o->box(FL_THIN_DOWN_BOX);
       {Fl_Button* o = new Fl_Button(10, 10, 140, 25, "Load File");
        o->box(FL_THIN_UP_BOX);
        o->callback((Fl_Callback*)cb_Load);
      }
       {Fl_Button* o = new Fl_Button(10, 40, 140, 25, "Exit");
        o->box(FL_THIN_UP_BOX);
        o->callback((Fl_Callback*)cb_Exit);
      }
      new Fl_Divider(10, 75, 140, 15, "label");
       {Fl_Button* o = new Fl_Button(10, 100, 140, 25, "Fit To Box");
        o->type(Fl_Button::TOGGLE);
        o->box(FL_THIN_UP_BOX);
        o->callback((Fl_Callback*)cb_Fit);
      }
       {Fl_Button* o = new Fl_Button(10, 130, 140, 25, "Tile");
        o->type(Fl_Button::TOGGLE);
        o->box(FL_THIN_UP_BOX);
        o->callback((Fl_Callback*)cb_Tile);
      }
       {Fl_Choice* o = filter_choice = new Fl_Choice(10, 335, 140, 25, "Filter:"); o->begin();
        o->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
        o->tooltip("Choose filter");
         {Fl_Item* o = new Fl_Item("None");
          o->user_data((void*)(0));
        }
         {Fl_Item* o = new Fl_Item("Brightness");
          o->user_data((void*)(FILTER_BRIGHTNESS));
        }
         {Fl_Item* o = new Fl_Item("Contrast");
          o->user_data((void*)(FILTER_CONTRAST));
        }
         {Fl_Item* o = new Fl_Item("Grayscale");
          o->user_data((void*)(FILTER_GRAYSCALE));
        }
         {Fl_Item* o = new Fl_Item("Gamma");
          o->user_data((void*)(FILTER_GAMMA));
        }
         {Fl_Item* o = new Fl_Item("Fore Blend");
          o->user_data((void*)(FILTER_FOREBLEND));
        }
         {Fl_Item* o = new Fl_Item("Back Blend");
          o->user_data((void*)(FILTER_BACKBLEND));
        }
        o->end();
      }
       {Fl_Box* o = new Fl_Box(10, 160, 140, 160);
        o->parent()->resizable(o);
      }
       {Fl_Value_Slider* o = Rslider = new Fl_Value_Slider(25, 380, 125, 15, "R");
        o->type(Fl_Value_Slider::HORIZONTAL);
        o->label_size(10);
        o->text_size(10);
        o->minimum(-3);
        o->maximum(3);
        o->value(1);
        o->slider_size(5);
        o->align(FL_ALIGN_LEFT);
        o->tooltip("Red value for filter");
      }
       {Fl_Value_Slider* o = Gslider = new Fl_Value_Slider(25, 400, 125, 15, "G");
        o->type(Fl_Value_Slider::HORIZONTAL);
        o->label_size(10);
        o->text_size(10);
        o->minimum(-3);
        o->maximum(3);
        o->value(1);
        o->slider_size(5);
        o->align(FL_ALIGN_LEFT);
        o->tooltip("Green value for filter");
      }
       {Fl_Value_Slider* o = Bslider = new Fl_Value_Slider(25, 420, 125, 15, "B");
        o->type(Fl_Value_Slider::HORIZONTAL);
        o->label_size(10);
        o->text_size(10);
        o->minimum(-3);
        o->maximum(3);
        o->value(1);
        o->slider_size(5);
        o->align(FL_ALIGN_LEFT);
        o->tooltip("Blue value for filter");
      }
       {Fl_Button* o = new Fl_Button(10, 445, 140, 25, "Apply");
        o->box(FL_THIN_UP_BOX);
        o->callback((Fl_Callback*)cb_Apply);
        o->tooltip("Apply current selected filter");
      }
       {Fl_Check_Button* o = lock = new Fl_Check_Button(10, 365, 140, 15, "Lock sliders");
        o->label_size(10);
        o->callback((Fl_Callback*)cb_lock);
        o->tooltip("Lock slider, RGB values taken from R slider ");
      }
      o->end();
    }
    o->end();
  }
  return  w;
}
Ejemplo n.º 4
0
int main(int argc, char **argv) {
	fl_open_display();
	/* start daemon if not started */
	xscreensaver_run_daemon(fl_display);

	SaverPrefs* sp = xscreensaver_read_config();

	main_win = new Fl_Double_Window(340, 445, _("Screensaver options"));
	/* so ESC does not interrupt running process */
	main_win->callback(close_cb);

	main_win->begin();
		/* monitor */
		Fl_Box* b1 = new Fl_Box(120, 163, 100, 15);
		b1->box(FL_BORDER_BOX);
		Fl_Box* b2 = new Fl_Box(65, 10, 210, 158);
		b2->box(FL_THIN_UP_BOX);

		Fl_Box* b3 = new Fl_Box(78, 20, 184, 138);
		b3->color(FL_BLACK);
		b3->box(FL_DOWN_BOX);

		/* preview window in 'b3' box */
		preview_win = new Fl_Double_Window(80, 22, 180, 134);
		preview_win->color(FL_BLACK);
		preview_win->begin();

		/* if failed to load any screensaver */
		if(!sp) {
			Fl_Box* b4 = new Fl_Box(0, 0, 180, 134, _("No screensavers found"));
			b4->labelcolor(FL_GRAY);
			b4->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP);
		}

		preview_win->end();

		Fl_Box* b4 = new Fl_Box(95, 173, 146, 14);
		b4->box(FL_THIN_UP_BOX);
		
		Fl_Group* g1 = new Fl_Group(10, 215, 320, 45, _("Screensaver"));
		g1->box(FL_ENGRAVED_BOX);
		g1->align(FL_ALIGN_TOP_LEFT);
		g1->begin();
			Fl_Choice* saver_list = new Fl_Choice(19, 225, 180, 25);
			saver_list->down_box(FL_BORDER_BOX);
			saver_list->add("(None)", 0, 0);

			if(sp) {
				int sel = 0;
				saver_list->callback((Fl_Callback*)choice_cb, sp);

				/* fix possible error */
				if(sp->curr_hack >= sp->hacks.size())
					sp->curr_hack = 0;

				HackListIter it = sp->hacks.begin(), it_end = sp->hacks.end();
				for(int i = 1; it != it_end; ++it, i++) {
					saver_list->add((*it)->name.c_str(), 0, 0);

					/*
					 * Check real hack index number against current one and let it match 
					 * position in our Fl_Choice list. Note that first item is '(None)'
					 * so 'i' starts from 1
					 */
					if(sp->mode != SAVER_OFF && (*it)->sindex == sp->curr_hack)
						sel = i;
				}

				saver_list->value(sel);
			}

			timeout_val = new Fl_Spinner(275, 226, 45, 25, _("Timeout:"));
			timeout_val->tooltip(_("Idle time in minutes after screensaver is started"));
			timeout_val->range(1, 500);
			if(sp)
				timeout_val->value(sp->timeout);
			else
				timeout_val->value(1);

		g1->end();

		Fl_Group* g2 = new Fl_Group(10, 290, 320, 110, _("Power management"));
		g2->box(FL_ENGRAVED_BOX);
		g2->align(FL_ALIGN_TOP_LEFT);
		g2->begin();
			Fl_Check_Button* denabled = new Fl_Check_Button(20, 299, 180, 26, _("Enabled"));
			denabled->down_box(FL_DOWN_BOX);
			denabled->tooltip(_("Enable or disable Display Power Management Signaling support"));
			if(sp) {
				denabled->callback((Fl_Callback*)dpms_enable_cb, sp);
				denabled->value(sp->dpms_enabled);
			} else {
				denabled->value(1);
			}

			Fl_Box* energy_image = new Fl_Box(20, 341, 75, 49);
			energy_image->image(image_energy);

			standby_val = new Fl_Spinner(275, 301, 45, 24, _("Standby:"));
			standby_val->tooltip(_("Minutes for standby"));
			standby_val->range(1, 500);
			if(sp)
				standby_val->value(sp->dpms_standby);
			else
				standby_val->value(1);

			suspend_val = new Fl_Spinner(275, 331, 45, 24, _("Suspend:"));
			suspend_val->tooltip(_("Minutes for suspend"));
			suspend_val->range(1, 500);
			if(sp)
				suspend_val->value(sp->dpms_suspend);
			else
				suspend_val->value(1);

			off_val = new Fl_Spinner(275, 360, 45, 24, _("Off:"));
			off_val->tooltip(_("Minutes to turn off the screen"));
			off_val->range(1, 500);
			if(sp)
				off_val->value(sp->dpms_off);
			else
				off_val->value(1);

			/* execute callback to apply changes before main_window is shown */
			denabled->do_callback();
		g2->end();

		Fl_Button* ok_button = new Fl_Button(145, 410, 90, 25, _("&OK"));
		ok_button->callback(ok_cb, sp);

		Fl_Button* close_button = new Fl_Button(240, 410, 90, 25, _("&Cancel"));
		close_button->callback(close_cb);
	main_win->end();

	main_win->show(argc, argv);
	/* run preview immediately */
	saver_list->do_callback();
	int ret = Fl::run();

	if(sp) {
		HackListIter it = sp->hacks.begin(), it_end = sp->hacks.end();
		for(; it != it_end; ++it)
			delete *it;
		delete sp;
	}

	return ret;
}
void editor::_editor() {
    //create the window
    keepUserdat=new std::vector<std::pair<unsigned,int64_t>>;
    luaCallback=new std::vector<std::pair<std::string,int64_t>>;
    startLuaConf();
    menu = new Fl_Menu_Bar(0,0,800,24);//Create menubar, items..
    lua_getglobal(Lconf,"generateMenu");
    runLuaFunc(Lconf,0,1);
    {   unsigned menucnt;
        std::vector<Fl_Menu_Item> tmp;
        if(!(menucnt=lua_rawlen(Lconf,-1))) {
            fl_alert("generateMenu must return a table");
            exit(1);
        }
        for(unsigned i=1; i<=menucnt; ++i) {
            lua_rawgeti(Lconf,-1,i);
            unsigned len=lua_rawlen(Lconf,-1);
            if(len) {
                Fl_Menu_Item mi{0};
                lua_rawgeti(Lconf,-1,1);
                char*txt=(char*)luaL_optstring(Lconf,-1,0);
                if(txt)
                    txt=strdup(txt);
                mi.text=txt;
                lua_pop(Lconf,1);
                if(len>=2) {
                    lua_rawgeti(Lconf,-1,2);
                    mi.shortcut_=luaL_optinteger(Lconf,-1,0);
                    lua_pop(Lconf,1);
                } else
                    mi.shortcut_=0;
                int64_t userdat;
                if(len>=4) {
                    lua_rawgeti(Lconf,-1,4);
                    userdat=luaL_optinteger(Lconf,-1,0);
                    lua_pop(Lconf,1);
                } else
                    userdat=0;

                if(len>=3) {
                    lua_rawgeti(Lconf,-1,3);
                    if(lua_type(Lconf,-1)==LUA_TSTRING) {
                        luaCallback->emplace_back(std::make_pair(lua_tostring(Lconf,-1),userdat));
                        mi.callback_=callLuaCB;
                        mi.user_data_=&(*luaCallback)[luaCallback->size()-1];
                    } else if(lua_type(Lconf,-1)==LUA_TNUMBER) {
                        int64_t lcall=lua_tointeger(Lconf,-1);
                        if(lcall>0) {
                            keepUserdat->emplace_back(std::make_pair(lcall-1,userdat));
                            mi.callback_=callCFuncLua;
                            mi.user_data_=&(*keepUserdat)[keepUserdat->size()-1];
                        } else
                            mi.callback_=0;
                    } else {
                        fl_alert("Error invalid type for callback %s",lua_typename(Lconf,lua_type(Lconf,-1)));
                        exit(1);
                    }
                    lua_pop(Lconf,1);
                } else {
                    mi.callback_=0;
                    mi.user_data_=0;
                }
                if(len>=5) {
                    lua_rawgeti(Lconf,-1,5);
                    mi.flags=luaL_optinteger(Lconf,-1,0);
                    lua_pop(Lconf,1);
                } else
                    mi.flags=0;
                tmp.emplace_back(mi);
            } else
                tmp.emplace_back(Fl_Menu_Item{0});
            lua_pop(Lconf,1);
        }
        unsigned cidx=0,lidx=0;
        for(unsigned i=0; i<menucnt; ++i) { //While resizing the vector the addresses may have changed.
            lua_rawgeti(Lconf,-1,i+1);
            unsigned len=lua_rawlen(Lconf,-1);
            if(len>=3) {
                lua_rawgeti(Lconf,-1,3);
                if(lua_type(Lconf,-1)==LUA_TSTRING) {
                    tmp[i].user_data_=&(*luaCallback)[lidx++];
                } else if(lua_type(Lconf,-1)==LUA_TNUMBER) {
                    int64_t lcall=lua_tointeger(Lconf,-1);
                    if(lcall>0)
                        tmp[i].user_data_=&(*keepUserdat)[cidx++];
                }
                lua_pop(Lconf,1);
            }
            lua_pop(Lconf,1);
        }
        lua_pop(Lconf,1);
        menu->copy(tmp.data());
    }
    tile_placer_tile_offset_y=default_tile_placer_tile_offset_y;
    true_color_box_x=default_true_color_box_x;
    true_color_box_y=default_true_color_box_y;
    tile_edit_truecolor_off_x=default_tile_edit_truecolor_off_x;
    tile_edit_truecolor_off_y=default_tile_edit_truecolor_off_y;
    std::fill(tabsHidden,&tabsHidden[shareAmtPj],false);
    {
        the_tabs = new Fl_Tabs(0, 24, 800, 576);
        the_tabs->callback(set_mode_tabs);
        int rx,ry,rw,rh;
        the_tabs->client_area(rx,ry,rw,rh);
        {
            tabsMain.emplace_back(new Fl_Group(rx, ry, rw, rh, "Palette editor"));
            //stuff related to this group should go here
            palBar.addTab(0,true);
            pal_size = new Fl_Hor_Value_Slider(128,384,320,24,"Palette box size");
            pal_size->minimum(1);
            pal_size->maximum(42);
            pal_size->step(1);
            pal_size->value(32);
            pal_size->align(FL_ALIGN_LEFT);
            pal_size->callback(redrawOnlyCB);
            ditherPower = new Fl_Hor_Value_Slider(128,416,320,24,"Dither Power");
            ditherPower->tooltip("A lower value results in more dithering artifacts a higher value results in less artifacts");
            ditherPower->minimum(1);
            ditherPower->maximum(256);
            ditherPower->step(1);
            ditherPower->value(16);
            ditherPower->align(FL_ALIGN_LEFT);
            ditherPower->callback(setSubditherSetting);
            gameSysSel=new Fl_Choice(96, 312, 192, 24);
            gameSysSel->copy(gameSysMenuSel);
            ditherAlgSel=new Fl_Choice(64, 464, 144, 24);
            ditherAlgSel->copy(ditherChoices);
            subSysC=new Fl_Choice(208, 464, 128, 24);
            subSysC->copy(subSysGenesis);
            subSysC->value(0);
            {   Fl_Group *o = new Fl_Group(306, 188, 88, 96);
                {
                    palType[0] = new Fl_Round_Button(306, 188, 64, 32, "Free");
                    palType[0]->type(FL_RADIO_BUTTON);
                    palType[0]->set();
                    palType[0]->callback((Fl_Callback*) setPalType,(void *)0);
                    palType[0]->tooltip(freeDes);
                    palType[1] = new Fl_Round_Button(306, 220, 72, 32, "Locked");
                    palType[1]->type(FL_RADIO_BUTTON);
                    palType[1]->callback((Fl_Callback*) setPalType,(void *)1);
                    palType[1]->tooltip(lockedDes);
                    palType[2] = new Fl_Round_Button(306, 252, 88, 32, "Reserved");
                    palType[2]->type(FL_RADIO_BUTTON);
                    palType[2]->callback((Fl_Callback*) setPalType,(void *)2);
                    palType[2]->tooltip(reservedDes);
                    o->end();
                } // End of buttons
            }//end of group

            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,pal_edit);
            runLuaFunc(Lconf,1,0);

            tabsMain[pal_edit]->end();
        } // Fl_Group* o
        {   tabsMain.emplace_back(new Fl_Group(rx, ry, rw, rh, "Tile editor"));
            //stuff related to this group should go here
            {   Fl_Group* o = new Fl_Group(0, 0, 800, 567);
                palRTE[0] = new Fl_Round_Button(384, default_palette_bar_offset_y+40, 56, 32, "Row 0");
                palRTE[0]->type(FL_RADIO_BUTTON);
                palRTE[0]->set();
                palRTE[0]->callback((Fl_Callback*) set_tile_row,(void *)0);
                palRTE[1] = new Fl_Round_Button(448, default_palette_bar_offset_y+40, 56, 32, "Row 1");
                palRTE[1]->type(FL_RADIO_BUTTON);
                palRTE[1]->callback((Fl_Callback*) set_tile_row,(void *)1);
                palRTE[2] = new Fl_Round_Button(512, default_palette_bar_offset_y+40, 56, 32, "Row 2");
                palRTE[2]->type(FL_RADIO_BUTTON);
                palRTE[2]->callback((Fl_Callback*) set_tile_row,(void *)2);
                palRTE[3] = new Fl_Round_Button(576, default_palette_bar_offset_y+40, 56, 32, "Row 3");
                palRTE[3]->type(FL_RADIO_BUTTON);
                palRTE[3]->callback((Fl_Callback*) set_tile_row,(void *)3);
                o->end();
            } // Fl_Group* o
            {   Fl_Button *o = new Fl_Button(538, default_palette_bar_offset_y, 104, 32, "Append tile");//these button should be inline with the palette bar
                o->tooltip("This will append a blank tile to the tile buffer in the ram.");
                o->callback(new_tile);
            }
            {   Fl_Button *o = new Fl_Button(656, default_palette_bar_offset_y, 140, 32, "Delete selected tile");
                o->tooltip("This button will delete the currently selected tile");
                o->callback(delete_tile_at_location);
                o->labelsize(12);
            }
            {   Fl_Button *o = new Fl_Button(656, default_palette_bar_offset_y+34,140, 32,"Insert after tile");
                o->callback(insertTileCB);
            }
            palBar.addTab(1);
            rgb_red = new Fl_Hor_Value_Slider(64,default_palette_bar_offset_y+136,128,24,"RGB red");
            rgb_red->minimum(0);
            rgb_red->maximum(255);
            rgb_red->step(1);
            rgb_red->value(0);
            rgb_red->align(FL_ALIGN_LEFT);
            rgb_red->callback(update_truecolor,(void *)0);
            rgb_green = new Fl_Hor_Value_Slider(240,default_palette_bar_offset_y+136,128,24,"Green");
            rgb_green->minimum(0);
            rgb_green->maximum(255);
            rgb_green->step(1);
            rgb_green->value(0);
            rgb_green->align(FL_ALIGN_LEFT);
            rgb_green->callback(update_truecolor,(void *)1);
            rgb_blue = new Fl_Hor_Value_Slider(402,default_palette_bar_offset_y+136,128,24,"Blue");
            rgb_blue->minimum(0);
            rgb_blue->maximum(255);
            rgb_blue->step(1);
            rgb_blue->value(0);
            rgb_blue->align(FL_ALIGN_LEFT);
            rgb_blue->callback(update_truecolor,(void *)2);
            rgb_alpha = new Fl_Hor_Value_Slider(576,default_palette_bar_offset_y+136,128,24,"Alpha");
            rgb_alpha->minimum(0);
            rgb_alpha->maximum(255);
            rgb_alpha->step(1);
            rgb_alpha->value(0);
            rgb_alpha->align(FL_ALIGN_LEFT);
            rgb_alpha->callback(update_truecolor,(void *)3);
            {   Fl_Group *o = new Fl_Group(304, 96, 88, 96);
                {
                    palType[3] = new Fl_Round_Button(304, 96, 64, 32, "Free");
                    palType[3]->type(FL_RADIO_BUTTON);
                    palType[3]->set();
                    palType[3]->callback((Fl_Callback*) setPalType,(void *)0);
                    palType[3]->tooltip(freeDes);
                    palType[4] = new Fl_Round_Button(304, 128, 72, 32, "Locked");
                    palType[4]->type(FL_RADIO_BUTTON);
                    palType[4]->callback((Fl_Callback*) setPalType,(void *)1);
                    palType[4]->tooltip(lockedDes);
                    palType[5] = new Fl_Round_Button(304, 160, 88, 32, "Reserved");
                    palType[5]->type(FL_RADIO_BUTTON);
                    palType[5]->callback((Fl_Callback*) setPalType,(void *)2);
                    palType[5]->tooltip(reservedDes);
                    o->end();
                } // End of buttons
            }//end of group
            {   Fl_Check_Button* o = new Fl_Check_Button(694,default_palette_bar_offset_y+68,100,32,"Show grid?");
                o->callback(set_grid);
                o->tooltip("This button Toggles weather or not you which to see a grid while editing your tiles. A grid can help you see the spacing between each pixel.");
            }
            tile_edit_offset_x=default_tile_edit_offset_x;
            tile_edit_offset_y=default_tile_edit_offset_y;
            tile_size = new Fl_Hor_Value_Slider(448,default_palette_bar_offset_y+72,242,24,"Tile zoom");
            tile_size->tooltip(TooltipZoom);
            tile_size->minimum(1);
            tile_size->maximum(64);
            tile_size->step(1);
            tile_size->value(46);
            tile_size->align(FL_ALIGN_LEFT);
            tile_size->callback(update_offset_tile_edit);
            //now for the tile select slider
            tile_select = new Fl_Hor_Value_Slider(480,default_palette_bar_offset_y+104,312,24,"Tile select");
            tile_select->tooltip("This slider selects which tile that you are editing the first tile is zero");
            tile_select->minimum(0);
            tile_select->maximum(0);
            tile_select->step(1);
            tile_select->align(FL_ALIGN_LEFT);
            tile_select->callback(set_tile_current);
            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,tile_edit);
            runLuaFunc(Lconf,1,0);
            tabsMain[tile_edit]->end();
        }
        {   tabsMain.emplace_back(new Fl_Group(rx,ry,rw,rh,"Plane mapping/block editor"));
            {   Fl_Group* o = new Fl_Group(tile_place_buttons_x_off, 192, 60, 128);
                palRTE[4] = new Fl_Round_Button(tile_place_buttons_x_off, 192, 60, 28, "Row 0");
                palRTE[4]->type(FL_RADIO_BUTTON);
                palRTE[4]->set();
                palRTE[4]->callback((Fl_Callback*) set_tile_row,(void *)0);
                palRTE[5] = new Fl_Round_Button(tile_place_buttons_x_off, 220, 60, 28, "Row 1");
                palRTE[5]->type(FL_RADIO_BUTTON);
                palRTE[5]->callback((Fl_Callback*) set_tile_row,(void *)1);
                palRTE[6] = new Fl_Round_Button(tile_place_buttons_x_off, 248, 60, 28, "Row 2");
                palRTE[6]->type(FL_RADIO_BUTTON);
                palRTE[6]->callback((Fl_Callback*) set_tile_row,(void *)2);
                palRTE[7] = new Fl_Round_Button(tile_place_buttons_x_off, 276, 60, 28, "Row 3");
                palRTE[7]->type(FL_RADIO_BUTTON);
                palRTE[7]->callback((Fl_Callback*) set_tile_row,(void *)3);
                o->end();
            } // Fl_Group* o


            planeSelect=new Fl_Choice(408,default_palette_bar_offset_y+56,112,24,"Plane selection");
            planeSelect->align(FL_ALIGN_TOP);

            {   Fl_Button *o = new Fl_Button(408, default_palette_bar_offset_y+80,112,24,"Add plane");
                o->callback(addPlaneTilemap);
            }

            {   Fl_Button *o = new Fl_Button(408, default_palette_bar_offset_y+104,112,24,"Remove plane");
                o->callback(removeTilemapsPlane);
            }

            curPlaneName = new Fl_Input(tile_place_buttons_x_off+616,56,168,24,"Plane name");
            curPlaneName->value("0");
            curPlaneName->callback(updateNameTilemaps);

            map_w = new Fl_Int_Input(608,default_palette_bar_offset_y+72,184,24,MapWidthTxt);
            map_w->when(FL_WHEN_ENTER_KEY);
            map_w->value("2");
            map_w->align(FL_ALIGN_LEFT);
            map_w->callback(callback_resize_map);
            map_h = new Fl_Int_Input(608,default_palette_bar_offset_y+104,184,24,MapHeightTxt);
            map_h->when(FL_WHEN_ENTER_KEY);
            map_h->value("2");
            map_h->align(FL_ALIGN_LEFT);
            map_h->callback(callback_resize_map);
            map_amt = new Fl_Int_Input(480,default_palette_bar_offset_y+136,312,24,"Blocks");
            map_amt->value("1");
            map_amt->align(FL_ALIGN_LEFT);
            map_amt->callback(blocksAmtCB);
            map_amt->hide();
            map_x_scroll = new Fl_Scrollbar(default_map_off_x-32, default_map_off_y-32, 800-8-default_map_off_x, 24);
            map_x_scroll->value(0,0,0,0);
            map_x_scroll->type(FL_HORIZONTAL);
            map_x_scroll->tooltip("Use this scroll bar to move around the tile map if you are zoomed in and there is not enough room to display the entire tilemap at once. This scroll bar will move the map left and right.");
            map_x_scroll->callback(update_map_scroll_x);
            map_x_scroll->hide();
            map_x_scroll->linesize(1);
            map_y_scroll = new Fl_Scrollbar(default_map_off_x-32, default_map_off_y, 24, 600-8-default_map_off_y);
            map_y_scroll->value(0,0,0,0);
            //map_x_scroll->type(FL_HORIZONTAL);
            map_y_scroll->tooltip("Use this scroll bar to move around the tile map if you are zoomed in and there is not enough room to display the entire tilemap at once. This scroll bar will move the map up and down.");
            map_y_scroll->callback(update_map_scroll_y);
            map_y_scroll->hide();
            map_y_scroll->linesize(1);
            //now for the tile select slider
            tile_select_2 = new Fl_Hor_Value_Slider(528,default_palette_bar_offset_y+40,264,24,"Tile select");
            tile_select_2->tooltip("This slider allows you to choice which tile you would like to place on the map remember you can both horizontally and vertically flip the tile once placed on the map and select which row the tile uses");
            tile_select_2->minimum(0);
            tile_select_2->maximum(0);
            tile_select_2->step(1);
            tile_select_2->align(FL_ALIGN_TOP_LEFT);
            tile_select_2->callback(set_tile_currentTP);
            totalTiles=new Fl_Box(600,default_palette_bar_offset_y,128,64);
            totalTiles->labelsize(12);
            palBar.addTab(2);
            //buttons for tile settings
            {   Fl_Group *o = new Fl_Group(304, 96, 88, 96);
                {
                    palType[6] = new Fl_Round_Button(304, 90, 64, 32, "Free");
                    palType[6]->type(FL_RADIO_BUTTON);
                    palType[6]->set();
                    palType[6]->callback((Fl_Callback*) setPalType,(void *)0);
                    palType[6]->tooltip(freeDes);
                    palType[7] = new Fl_Round_Button(304, 122, 72, 32, "Locked");
                    palType[7]->type(FL_RADIO_BUTTON);
                    palType[7]->callback((Fl_Callback*) setPalType,(void *)1);
                    palType[7]->tooltip(lockedDes);
                    palType[8] = new Fl_Round_Button(304, 154, 88, 32, "Reserved");
                    palType[8]->type(FL_RADIO_BUTTON);
                    palType[8]->callback((Fl_Callback*) setPalType,(void *)2);
                    palType[8]->tooltip(reservedDes);
                    o->end();
                } // End of buttons
            }//end of group

            hflipCB[0] = new Fl_Check_Button(tile_place_buttons_x_off,304,64,32,"Hflip");
            hflipCB[0]->callback(set_hflipCB,(void*)0);
            hflipCB[0]->tooltip("This sets whether or not the tile is flipped horizontally");
            vflipCB[0] = new Fl_Check_Button(tile_place_buttons_x_off,336,64,32,"Vflip");
            vflipCB[0]->callback(set_vflipCB,(void*)0);
            vflipCB[0]->tooltip("This sets whether or not the tile is flipped vertically");
            prioCB[0] = new Fl_Check_Button(tile_place_buttons_x_off,368,72,32,"Priority");
            prioCB[0]->callback(set_prioCB,(void*)0);
            prioCB[0]->tooltip("If checked tile is high priority");
            {   Fl_Check_Button* o = new Fl_Check_Button(tile_place_buttons_x_off,400,96,32,"Show grid?");
                o->callback(set_grid_placer);
                o->tooltip("This button toggles whether or not a grid is visible over the tile map this will allow you to easily see were each tile is");
            }
            BlocksCBtn = new Fl_Check_Button(tile_place_buttons_x_off,432,96,32,"Blocks?");
            BlocksCBtn->callback(toggleBlocksCB);
            BlocksCBtn->tooltip("Toggles if tile map is treated as blocks");
            {   Fl_Check_Button* o = new Fl_Check_Button(tile_place_buttons_x_off,464,192,32,"Show only selected row");
                o->callback(toggleRowSolo);
                o->tooltip("When checked tiles that do not use the selected row will not be drawn");
            }
            place_tile_size = new Fl_Hor_Value_Slider(tile_place_buttons_x_off,512,168,24,"Tile zoom factor:");
            place_tile_size->minimum(1);
            place_tile_size->maximum(16);
            place_tile_size->step(1);
            place_tile_size->value(12);
            place_tile_size->align(FL_ALIGN_TOP);
            place_tile_size->callback(update_map_size);
            place_tile_size->tooltip(TooltipZoom);

            tmapOffset = new Fl_Int_Input(tile_place_buttons_x_off,552,168,24,"Tile offset");
            tmapOffset->when(FL_WHEN_ENTER_KEY);
            tmapOffset->value("0");
            tmapOffset->align(FL_ALIGN_TOP);
            tmapOffset->callback(setTmapOffsetCB);

            cordDisp[0]=new Fl_Box(tile_place_buttons_x_off,556,128,64);
            cordDisp[0]->labelsize(12);

            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,tile_place);
            runLuaFunc(Lconf,1,0);
            tabsMain[tile_place]->end();
        }
        {   tabsMain.emplace_back(new Fl_Group(rx,ry,rw,rh,"Chunk editor"));
            useBlocksChunkCBtn=new Fl_Check_Button(8, 48, 152, 24, "Use blocks");
            useBlocksChunkCBtn->callback(useBlocksCB);

            chunkX = new Fl_Scrollbar(DefaultChunkX-32, DefaultChunkY-32, 800-DefaultChunkX+24, 24);
            chunkX->value(0,0,0,0);
            chunkX->type(FL_HORIZONTAL);
            chunkX->callback(scrollChunkX);
            chunkX->hide();

            chunkY = new Fl_Scrollbar(DefaultChunkX-32, DefaultChunkY, 24, 600-8-DefaultChunkY);
            chunkY->value(0,0,0,0);
            chunkY->callback(scrollChunkY);
            chunkY->hide();

            chunk_select = new Fl_Hor_Value_Slider(tile_place_buttons_x_off,88,160,24,"Chunk select");
            chunk_select->minimum(0);
            chunk_select->maximum(0);
            chunk_select->step(1);
            chunk_select->value(0);
            chunk_select->align(FL_ALIGN_TOP);
            chunk_select->callback(currentChunkCB);

            tile_select_3 = new Fl_Hor_Value_Slider(tile_place_buttons_x_off,136,160,24,"Tile select");
            tile_select_3->minimum(0);
            tile_select_3->maximum(0);
            tile_select_3->step(1);
            tile_select_3->align(FL_ALIGN_TOP);
            tile_select_3->callback(selBlockCB);

            hflipCB[1] = new Fl_Check_Button(tile_place_buttons_x_off,160,64,32,"Hflip");
            hflipCB[1]->callback(set_hflipCB,(void*)1);
            vflipCB[1] = new Fl_Check_Button(tile_place_buttons_x_off,192,64,32,"Vflip");
            vflipCB[1]->callback(set_vflipCB,(void*)1);
            prioCB[1] = new Fl_Check_Button(tile_place_buttons_x_off,224,72,32,"Priority");
            prioCB[1]->callback(set_prioCB,(void*)1);

            solidChunkMenu=new Fl_Choice(tile_place_buttons_x_off,256,128,24);
            solidChunkMenu->copy(SolidMenu);

            chunksize[0]=new Fl_Int_Input(tile_place_buttons_x_off,296,128,24,"Width (in tiles)");
            chunksize[0]->when(FL_WHEN_ENTER_KEY);
            chunksize[0]->align(FL_ALIGN_TOP);
            chunksize[0]->callback(resizeChunkCB);
            chunksize[0]->value("16");

            chunksize[1]=new Fl_Int_Input(tile_place_buttons_x_off,336,128,24,"Height (in tiles)");
            chunksize[1]->when(FL_WHEN_ENTER_KEY);
            chunksize[1]->align(FL_ALIGN_TOP);
            chunksize[1]->callback(resizeChunkCB);
            chunksize[1]->value("16");

            planeSelectChunk = new Fl_Hor_Value_Slider(tile_place_buttons_x_off,480,160,24,"Plane select");
            planeSelectChunk->minimum(0);
            planeSelectChunk->maximum(0);
            planeSelectChunk->step(1);
            planeSelectChunk->align(FL_ALIGN_TOP);
            planeSelectChunk->callback(setCurPlaneChunkCB);

            chunk_tile_size = new Fl_Hor_Value_Slider(tile_place_buttons_x_off,520,160,24,"Tile zoom factor:");
            chunk_tile_size->minimum(1);
            chunk_tile_size->maximum(16);
            chunk_tile_size->step(1);
            chunk_tile_size->value(2);
            chunk_tile_size->align(FL_ALIGN_TOP);
            chunk_tile_size->callback(scrollChunkCB);
            chunk_tile_size->tooltip(TooltipZoom);

            cordDisp[1]=new Fl_Box(tile_place_buttons_x_off,556,128,64);
            cordDisp[1]->labelsize(12);

            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off,364, 112, 32, "Append chunk");
                o->callback(appendChunkCB);
            }

            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off,396, 128, 32, "Insert after chunk");
                o->callback(insertChunkCB);
            }
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off,428, 160, 32, "Delete selected chunk");
                o->callback(delChunkAtCB);
            }
            updateChunkSize();

            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,chunkEditor);
            runLuaFunc(Lconf,1,0);
            tabsMain[chunkEditor]->end();
        }
        {   tabsMain.emplace_back(new Fl_Group(rx,ry,rw,rh,"Sprites"));
            palBar.addTab(3,false,true,true);
            {   Fl_Group *o = new Fl_Group(tile_place_buttons_x_off+616, 44, 88, 96);
                {
                    palType[9] = new Fl_Round_Button(tile_place_buttons_x_off+616, 44, 64, 24, "Free");
                    palType[9]->type(FL_RADIO_BUTTON);
                    palType[9]->set();
                    palType[9]->callback((Fl_Callback*) setPalType,(void *)0);
                    palType[9]->tooltip(freeDes);
                    palType[10] = new Fl_Round_Button(tile_place_buttons_x_off+616, 68, 72, 24, "Locked");
                    palType[10]->type(FL_RADIO_BUTTON);
                    palType[10]->callback((Fl_Callback*) setPalType,(void *)1);
                    palType[10]->tooltip(lockedDes);
                    palType[11] = new Fl_Round_Button(tile_place_buttons_x_off+616, 92, 88, 24, "Reserved");
                    palType[11]->type(FL_RADIO_BUTTON);
                    palType[11]->callback((Fl_Callback*) setPalType,(void *)2);
                    palType[11]->tooltip(reservedDes);
                    o->end();
                }
            }

            spritegrouptxt = new Fl_Input(tile_place_buttons_x_off+616,128,168,24,"Group name");
            spritegrouptxt->align(FL_ALIGN_TOP);
            spritegrouptxt->value(spriteDefName);
            spritegrouptxt->callback(assignSpritegroupnameCB);

            spritemetatxt = new Fl_Input(tile_place_buttons_x_off+616,168,168,24,"Meta name");
            spritemetatxt->value(spritesName);
            spritemetatxt->callback(assignSpritemetaNameCB);
            spritemetatxt->align(FL_ALIGN_TOP);

            spriteglobaltxt = new Fl_Input(tile_place_buttons_x_off+616,208,168,24,"All meta name");
            spriteglobaltxt->value(defMDesc);
            spriteglobaltxt->callback(assignSpriteAllMetanameCB);
            spriteglobaltxt->align(FL_ALIGN_TOP);


            metaspritesel=new Fl_Hor_Value_Slider(tile_place_buttons_x_off+616,244,168,24,"Meta group select:");
            metaspritesel->step(1);
            metaspritesel->maximum(0);
            metaspritesel->align(FL_ALIGN_TOP);
            metaspritesel->callback(selspriteMeta);
            metaspritesel->labelsize(12);


            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off+616, 274, 96, 28, "Append meta");
                o->callback(appendSpriteCB,(void*)(intptr_t)2);
            }

            spriteselgroup=new Fl_Hor_Value_Slider(tile_place_buttons_x_off,184,168,22,"Sprite group select:");
            spriteselgroup->step(1);
            spriteselgroup->maximum(0);
            spriteselgroup->align(FL_ALIGN_TOP);
            spriteselgroup->callback(selspriteGroup);
            spriteselgroup->labelsize(12);

            spritesel=new Fl_Hor_Value_Slider(tile_place_buttons_x_off,220,168,22,"Sprite select:");
            spritesel->step(1);
            spritesel->maximum(0);
            spritesel->align(FL_ALIGN_TOP);
            spritesel->callback(selSpriteCB);
            spritesel->labelsize(12);

            spritest=new Fl_Hor_Value_Slider(tile_place_buttons_x_off,256,168,22,"Start tile:");
            spritest->step(1);
            spritest->maximum(0);
            spritest->align(FL_ALIGN_TOP);
            spritest->callback(setvalueSpriteCB,0);
            spritest->labelsize(12);

            spriteslat=new Fl_Hor_Value_Slider(tile_place_buttons_x_off,292,168,22,"Mapping tile");
            spriteslat->step(1);
            spriteslat->maximum(0);
            spriteslat->align(FL_ALIGN_TOP);
            spriteslat->callback(setvalueSpriteCB,(void*)4);
            spriteslat->labelsize(12);

            spritesize[0]=new Fl_Hor_Value_Slider(tile_place_buttons_x_off+40,316,128,22,"Width");
            spritesize[0]->step(1);
            spritesize[0]->value(1);
            spritesize[0]->minimum(1);
            spritesize[0]->maximum(4);
            spritesize[0]->align(FL_ALIGN_LEFT);
            spritesize[0]->callback(setvalueSpriteCB,(void*)1);
            spritesize[0]->labelsize(12);

            spritesize[1]=new Fl_Hor_Value_Slider(tile_place_buttons_x_off+40,340,128,22,"Height");
            spritesize[1]->step(1);
            spritesize[1]->value(1);
            spritesize[1]->minimum(1);
            spritesize[1]->maximum(4);
            spritesize[1]->align(FL_ALIGN_LEFT);
            spritesize[1]->callback(setvalueSpriteCB,(void*)2);
            spritesize[1]->labelsize(12);

            spritepalrow=new Fl_Hor_Value_Slider(tile_place_buttons_x_off,376,168,22,"Palette row:");
            spritepalrow->step(1);
            spritepalrow->maximum(3);
            spritepalrow->align(FL_ALIGN_TOP);
            spritepalrow->callback(setvalueSpriteCB,(void*)3);
            spritepalrow->labelsize(12);

            spritezoom=new Fl_Hor_Value_Slider(tile_place_buttons_x_off+38,400,130,22,"Zoom");
            spritezoom->step(1);
            spritezoom->minimum(1);
            spritezoom->value(16);
            spritezoom->maximum(16);
            spritezoom->align(FL_ALIGN_LEFT);
            spritezoom->callback(redrawOnlyCB);
            spritezoom->labelsize(12);

            spritesoff[0] = new Fl_Int_Input(tile_place_buttons_x_off+62,424,106,24,"Offset X:");
            spritesoff[0]->when(FL_WHEN_ENTER_KEY);
            spritesoff[0]->value("0");
            spritesoff[0]->align(FL_ALIGN_LEFT);
            spritesoff[0]->callback(setoffspriteCB,0);

            spritesoff[1] = new Fl_Int_Input(tile_place_buttons_x_off+62,448,106,24,"Offset Y:");
            spritesoff[1]->when(FL_WHEN_ENTER_KEY);
            spritesoff[1]->value("0");
            spritesoff[1]->align(FL_ALIGN_LEFT);
            spritesoff[1]->callback(setoffspriteCB,(void*)1);

            spritehflip = new Fl_Check_Button(tile_place_buttons_x_off,470,48,20,"Hflip");
            spritehflip->callback(spriteHflipCB);
            spritevflip = new Fl_Check_Button(tile_place_buttons_x_off+52,470,48,20,"Vflip");
            spritevflip->callback(spriteVflipCB);
            spriteprio = new Fl_Check_Button(tile_place_buttons_x_off+104,470,56,20,"Priority");
            spriteprio->callback(spritePrioCB);

            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off, 492, 64, 28, "Append");
                o->callback(appendSpriteCB,0);
                o->labelsize(12);
            }
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off+72, 492, 96, 28, "Append group");
                o->callback(appendSpriteCB,(void*)(intptr_t)1);
                o->labelsize(12);
            }
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off, 522, 64, 28, "Delete");
                o->callback(delSpriteCB,0);
                o->labelsize(12);
            }
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off+72, 522, 96, 28, "Delete group");
                o->callback(delSpriteCB,(void*)1);
                o->labelsize(12);
            }
            spritealign[0] = new Fl_Button(tile_place_buttons_x_off, 552, 32, 28, "Left");
            spritealign[0]->labelsize(12);
            spritealign[0]->callback(alignSpriteCB,(void*)0);

            spritealign[1] = new Fl_Button(tile_place_buttons_x_off+34, 552, 40, 28, "Right");
            spritealign[1]->labelsize(12);
            spritealign[1]->callback(alignSpriteCB,(void*)1);

            spritealign[2] = new Fl_Button(tile_place_buttons_x_off+78, 552, 28, 28, "Top");
            spritealign[2]->labelsize(12);
            spritealign[2]->callback(alignSpriteCB,(void*)2);

            spritealign[3] = new Fl_Button(tile_place_buttons_x_off+112, 552, 48, 28, "Bottom");
            spritealign[3]->labelsize(12);
            spritealign[3]->callback(alignSpriteCB,(void*)3);

            {
                Fl_Group *o = new Fl_Group(tile_place_buttons_x_off, 572, 800, 480);
                {
                    Fl_Round_Button*m = new Fl_Round_Button(tile_place_buttons_x_off, 572, 96, 32, "Top corner");
                    m->type(FL_RADIO_BUTTON);
                    m->callback(setDrawSpriteCB,(void *)0);
                    m->set();
                } // Fl_Round_Button* o
                {
                    Fl_Round_Button*m = new Fl_Round_Button(tile_place_buttons_x_off+96, 572, 64, 32, "Center");
                    m->type(FL_RADIO_BUTTON);
                    m->callback(setDrawSpriteCB,(void *)1);
                } // Fl_Round_Button* o
                o->end();
            } // End of buttons

            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,spriteEditor);
            runLuaFunc(Lconf,1,0);
            tabsMain[spriteEditor]->end();
        }
        {   tabsMain.emplace_back(new Fl_Group(rx,ry,rw,rh,"Level editor"));
            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,levelEditor);
            runLuaFunc(Lconf,1,0);
            tabsMain[levelEditor]->end();
        }
        {   tabsMain.emplace_back(new Fl_Group(rx,ry,rw,rh,"Settings/projects"));
            projectSelect=new Fl_Hor_Value_Slider(112,56,128,24,"Current project");
            projectSelect->minimum(0);
            projectSelect->maximum(0);
            projectSelect->step(1);
            projectSelect->value(0);
            projectSelect->align(FL_ALIGN_LEFT);
            projectSelect->callback(switchProjectCB);
            {   Fl_Button *o = new Fl_Button(260, 52, 152, 32, "Append blank project");
                o->callback(appendProjectCB);
            }
            {   Fl_Button *o = new Fl_Button(428, 52, 168, 32, "Delete selected project");
                o->callback(deleteProjectCB);
            }
            //IMPORTANT if adding a new tab remember to update these
            sharePrj[0]=new Fl_Check_Button(8,112,112,16,"Share palette");
            sharePrj[0]->callback(shareProjectCB,(void*)pjHavePal);
            sharePrj[1]=new Fl_Check_Button(120,112,96,16,"Share tiles");
            sharePrj[1]->callback(shareProjectCB,(void*)pjHaveTiles);
            sharePrj[2]=new Fl_Check_Button(216,112,120,16,"Share tile map");
            sharePrj[2]->callback(shareProjectCB,(void*)pjHaveMap);
            sharePrj[3]=new Fl_Check_Button(336,112,120,16,"Share chunks");
            sharePrj[3]->callback(shareProjectCB,(void*)pjHaveChunks);
            sharePrj[4]=new Fl_Check_Button(456,112,120,16,"Share sprites");
            sharePrj[4]->callback(shareProjectCB,(void*)pjHaveSprites);
            sharePrj[5]=new Fl_Check_Button(576,112,120,16,"Share level");
            sharePrj[5]->callback(shareProjectCB,(void*)pjHaveLevel);

            havePrj[0]=new Fl_Check_Button(8,88,112,16,"Have palette");
            havePrj[0]->callback(haveCB,(void*)pjHavePal);
            havePrj[1]=new Fl_Check_Button(120,88,96,16,"Have tiles");
            havePrj[1]->callback(haveCB,(void*)pjHaveTiles);
            havePrj[2]=new Fl_Check_Button(232,88,120,16,"Have tile map");
            havePrj[2]->callback(haveCB,(void*)pjHaveMap);
            havePrj[3]=new Fl_Check_Button(344,88,120,16,"Have chunks");
            havePrj[3]->callback(haveCB,(void*)pjHaveChunks);
            havePrj[4]=new Fl_Check_Button(456,88,120,16,"Have sprites");
            havePrj[4]->callback(haveCB,(void*)pjHaveSprites);
            havePrj[5]=new Fl_Check_Button(568,88,120,16,"Have level");
            havePrj[5]->callback(haveCB,(void*)pjHaveLevel);

            shareWith[0]=new Fl_Hor_Value_Slider(8,142,128,24,"Share palette with:");
            shareWith[0]->callback(switchShareCB,(void*)pjHavePal);
            shareWith[1]=new Fl_Hor_Value_Slider(136,142,128,24,"Share tiles with:");
            shareWith[1]->callback(switchShareCB,(void*)pjHaveTiles);
            shareWith[2]=new Fl_Hor_Value_Slider(264,142,128,24,"Share tile map with:");
            shareWith[2]->callback(switchShareCB,(void*)pjHaveMap);
            shareWith[3]=new Fl_Hor_Value_Slider(400,142,128,24,"Share chunks with:");
            shareWith[3]->callback(switchShareCB,(void*)pjHaveChunks);
            shareWith[4]=new Fl_Hor_Value_Slider(536,142,128,24,"Share sprites with:");
            shareWith[4]->callback(switchShareCB,(void*)pjHaveSprites);
            shareWith[5]=new Fl_Hor_Value_Slider(672,142,128,24,"Share level with:");
            shareWith[5]->callback(switchShareCB,(void*)pjHaveLevel);
            for(unsigned x=0; x<shareAmtPj; ++x) {
                havePrj[x]->value(1);
                shareWith[x]->minimum(0);
                shareWith[x]->maximum(0);
                shareWith[x]->step(1);
                shareWith[x]->value(0);
                shareWith[x]->align(FL_ALIGN_TOP);
            }


            TxtBufProject = new Fl_Text_Buffer;
            TxtEditProject = new Fl_Text_Editor(8, 184, 640, 370,"Description/Notes");
            TxtEditProject->buffer(TxtBufProject);
            TxtEditProject->textfont(FL_TIMES);
            TxtBufProject->text(currentProject->Name.c_str());
            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,settingsTab);
            runLuaFunc(Lconf,1,0);
            tabsMain[settingsTab]->end();
        }
        {   tabsMain.emplace_back(new Fl_Group(rx,ry,rw,rh,"Lua scripting"));
            luaScriptSel=new Fl_Choice(tile_place_buttons_x_off,default_palette_bar_offset_y+8,112,24);
            luaScriptSel->label("Script selection");
            luaScriptSel->align(FL_ALIGN_TOP);
            luaScriptSel->callback(switchCurLuaScript);
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off+120, default_palette_bar_offset_y,112, 32, "Append script");
                o->callback(appendLuaScript);
            }
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off+240, default_palette_bar_offset_y,144,32, "Delete selected script");
                o->callback(deleteLuaScript);
            }
            {   Fl_Button *o = new Fl_Button(tile_place_buttons_x_off+392, default_palette_bar_offset_y,48,32, "Run");
                o->callback(runCurLuaScript);
            }
            luaScriptName = new Fl_Input(tile_place_buttons_x_off+448+8,default_palette_bar_offset_y+8,328,24,"Script name");
            luaScriptName->callback(setNameLuaScript);
            luaScriptName->align(FL_ALIGN_TOP);
            luaBufProject = new Fl_Text_Buffer;
            luaEditProject = new Fl_Text_Editor(tile_place_buttons_x_off,default_palette_bar_offset_y+48, 784, 456,"Currently selected Lua script");
            luaEditProject->buffer(luaBufProject);
            luaEditProject->textfont(FL_COURIER);
            luaEditProject->hide();
            lua_getglobal(Lconf,"tabConfig");
            lua_pushinteger(Lconf,luaTab);
            runLuaFunc(Lconf,1,0);
            tabsMain[luaTab]->end();
        }
    }
}
Ejemplo n.º 6
0
int main (int argc, char **argv) {

  Fl_Window* w;
  fl_init_locale_support("eiconsconf", PREFIX"/share/locale");
  readIconsConfiguration();
   {Fl_Window* o = iconsConfWindow = new Fl_Window(265, 314, _("Icons settings"));
    w = o;
    o->shortcut(0xff1b);
     {Fl_Button* o = new Fl_Button(25, 280, 75, 25, _("&OK"));
      o->callback((Fl_Callback*)cb_OK);
    }
     {Fl_Button* o = new Fl_Button(185, 280, 75, 25, _("&Cancel"));
      o->callback((Fl_Callback*)cb_Cancel);
    }
     {Fl_Button* o = new Fl_Button(105, 280, 75, 25, _("&Apply"));
      o->callback((Fl_Callback*)cb_Apply);
    }
     {Fl_Tabs* o = new Fl_Tabs(3, 5, 257, 265);
      o->color((Fl_Color)0xfffffffe);
       {Fl_Group* o = new Fl_Group(1, 23, 255, 241, _("Look&&feel"));
        o->align(FL_ALIGN_TOP|FL_ALIGN_LEFT);
         {Fl_Button* o = colorButton = new Fl_Button(165, 17, 60, 18, _("Background color: "));
          o->box(FL_DOWN_BOX);
          o->callback((Fl_Callback*)cb_colorButton);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP);
          o->color((Fl_Color) label_background);
          if(label_trans) o->deactivate();
        }
         {Fl_Button* o = colorButton1 = new Fl_Button(165, 47, 60, 18, _("Label color: "));
          o->box(FL_DOWN_BOX);
          o->callback((Fl_Callback*)cb_colorButton1);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP);
          o->color((Fl_Color) label_foreground);
        }
         {Fl_Value_Slider* o = maxWidthSlider = new Fl_Value_Slider(115, 95, 125, 20, _("Maximum width: "));
          o->type(Fl_Value_Slider::HORIZONTAL);
          o->minimum(48);
          o->maximum(200);
          o->step(1);
          o->value(50);
          o->slider_size(10);
          o->callback((Fl_Callback*)cb_maxWidthSlider);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP);
          o->value(label_maxwidth);
        }
         {Fl_Value_Slider* o = fontsizeSlider = new Fl_Value_Slider(115, 125, 125, 20, _("Font height: "));
          o->type(Fl_Value_Slider::HORIZONTAL|Fl_Slider::TICK_ABOVE);
          o->minimum(8);
          o->maximum(48);
          o->step(1);
          o->value(10);
          o->slider_size(10);
          o->callback((Fl_Callback*)cb_fontsizeSlider);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP);
          o->value(label_fontsize);
        }
         {Fl_Value_Slider* o = gridspaceSlider = new Fl_Value_Slider(115, 155, 125, 20, _("Grid spacing: "));
          o->type(Fl_Value_Slider::HORIZONTAL|Fl_Slider::TICK_ABOVE);
          o->minimum(1);
          o->maximum(50);
          o->step(1);
          o->value(10);
          o->slider_size(10);
          o->callback((Fl_Callback*)cb_gridspaceSlider);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP);
          o->value(label_gridspacing);
        }
         {Fl_Check_Button* o = autoArrButton = new Fl_Check_Button(25, 215, 222, 20, _("Auto arrange icons"));
          o->callback((Fl_Callback*)cb_autoArrButton);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
          o->value(auto_arr);
        }
         {Fl_Check_Button* o = engageButton = new Fl_Check_Button(25, 190, 222, 20, _("Engage with just one click"));
          o->callback((Fl_Callback*)cb_engageButton);
          o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
          o->value(label_engage_1click);
        }
         {Fl_Check_Button* o = bg_color_check = new Fl_Check_Button(227, 17, 20, 18);
          o->callback((Fl_Callback*)cb_bg_color_check);
          o->tooltip(_("Clear this, to get transparent background."));
          if(!label_trans) o->set_value();
        }
        o->end();
      }
      o->end();
    }
    o->end();
    o->resizable(o);
  }
  w->show(argc, argv);
  return  Fl::run();
}