//--------------------------------------------------------- bool DLG_Open(wxString &File_Path, const wxString &Caption, const wxString &def_Dir, const wxString &def_File, const wxString &Filter) { wxString Dir(def_Dir); if( !wxDirExists(def_Dir) ) { CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir); } wxFileDialog dlg(MDI_Get_Top_Window(), Caption, Dir, def_File, Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST); if( dlg.ShowModal() == wxID_OK ) { File_Path = dlg.GetPath(); if( !wxDirExists(def_Dir) ) { CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str()); } return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Open(wxArrayString &File_Paths, const wxString &Caption, const wxString &def_Dir, const wxString &Filter) { wxString Dir(def_Dir); if( !wxDirExists(def_Dir) ) { CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir); } wxFileDialog dlg(MDI_Get_Top_Window(), Caption, Dir, wxT(""), Filter, wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_MULTIPLE); if( dlg.ShowModal() == wxID_OK ) { dlg.GetPaths(File_Paths); if( File_Paths.GetCount() > 0 ) { if( !wxDirExists(def_Dir) ) { CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Paths[0]).w_str()); } return( true ); } } return( false ); }
//--------------------------------------------------------- bool DLG_Colors(int &Palette) { wxString Palettes[SG_COLORS_COUNT]; for(int i=0; i<SG_COLORS_COUNT; i++) { Palettes[i] = SG_Colors_Get_Name(i).c_str(); } wxSingleChoiceDialog dlg( MDI_Get_Top_Window(), wxT(""), _TL("Preset Selection"), SG_COLORS_COUNT, Palettes ); if( dlg.ShowModal() == wxID_OK ) { Palette = dlg.GetSelection(); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Image_Save(wxString &File_Path, int &Type, const wxChar *def_Dir, const wxChar *def_File) { static int Filter_Index = 3; wxFileDialog dlg( MDI_Get_Top_Window(), LNG("[CAP] Save As Image"), def_Dir, def_File, wxString::Format( wxT("%s (*.bmp)|*.bmp|") wxT("%s (*.jpg)|*.jpg;*.jif;*.jpeg|") wxT("%s (*.tif)|*.tif;*.tiff|") wxT("%s (*.png)|*.png|") wxT("%s (*.gif)|*.gif|") wxT("%s (*.pcx)|*.pcx"), LNG("Windows or OS/2 Bitmap"), LNG("JPEG - JFIF Compliant"), LNG("Tagged Image File Format"), LNG("Portable Network Graphics"), LNG("CompuServe Graphics Interchange"), LNG("Zsoft Paintbrush") ), wxSAVE|wxOVERWRITE_PROMPT ); dlg.SetFilterIndex(Filter_Index); if( dlg.ShowModal() == wxID_OK ) { File_Path = dlg.GetPath(); Filter_Index = dlg.GetFilterIndex(); switch( Filter_Index ) { default: case 0: Type = wxBITMAP_TYPE_BMP; break; case 1: Type = wxBITMAP_TYPE_JPEG; break; case 2: Type = wxBITMAP_TYPE_TIF; break; case 3: Type = wxBITMAP_TYPE_PNG; break; case 4: Type = wxBITMAP_TYPE_GIF; break; case 5: Type = wxBITMAP_TYPE_PCX; break; case 6: Type = wxBITMAP_TYPE_PNM; break; } return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Image_Save(wxString &File_Path, int &Type, const wxString &def_Dir, const wxString &def_File) { static int Filter_Index = 3; wxString Dir(def_Dir); if( !wxDirExists(def_Dir) ) { CONFIG_Read(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), Dir); } wxFileDialog dlg( MDI_Get_Top_Window(), _TL("Save As Image"), Dir, def_File, wxString::Format( "%s (*.bmp)|*.bmp|" "%s (*.jpg)|*.jpg;*.jif;*.jpeg|" "%s (*.tif)|*.tif;*.tiff|" "%s (*.png)|*.png|" "%s (*.gif)|*.gif|" "%s (*.pcx)|*.pcx", _TL("Windows or OS/2 Bitmap"), _TL("JPEG - JFIF Compliant"), _TL("Tagged Image File Format"), _TL("Portable Network Graphics"), _TL("CompuServe Graphics Interchange"), _TL("Zsoft Paintbrush") ), wxFD_SAVE|wxFD_OVERWRITE_PROMPT ); dlg.SetFilterIndex(Filter_Index); if( dlg.ShowModal() == wxID_OK ) { File_Path = dlg.GetPath(); Filter_Index = dlg.GetFilterIndex(); switch( Filter_Index ) { default: Type = wxBITMAP_TYPE_BMP ; break; case 1: Type = wxBITMAP_TYPE_JPEG; break; case 2: Type = wxBITMAP_TYPE_TIF ; break; case 3: Type = wxBITMAP_TYPE_PNG ; break; case 4: Type = wxBITMAP_TYPE_GIF ; break; case 5: Type = wxBITMAP_TYPE_PCX ; break; case 6: Type = wxBITMAP_TYPE_PNM ; break; } if( !wxDirExists(def_Dir) ) { CONFIG_Write(CONFIG_GROUP_FILE_DLG, DLG_Get_FILE_Config(-1), SG_File_Get_Path(File_Path).w_str()); } return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Directory(wxString &Directory, const wxString &Caption, const wxString &def_Dir) { wxDirDialog dlg(MDI_Get_Top_Window(), Caption, def_Dir); if( dlg.ShowModal() == wxID_OK ) { Directory = dlg.GetPath(); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Get_Text(wxString &Value, const wxString &Caption, const wxString &Text) { wxTextEntryDialog dlg(MDI_Get_Top_Window(), Text, Caption, Value); if( dlg.ShowModal() == wxID_OK ) { Value = dlg.GetValue(); return( true ); } return( false ); }
//--------------------------------------------------------- int DLG_Message_Show_Error(const wxString &Message, const wxString &Caption) { wxMessageDialog dlg(MDI_Get_Top_Window(), Message, Caption, wxOK|wxCANCEL|wxICON_ERROR); switch( dlg.ShowModal() ) { case wxID_OK: default: return( 1 ); case wxID_CANCEL: return( 0 ); } }
//--------------------------------------------------------- bool DLG_Open(wxString &File_Path, const wxChar *Caption, const wxChar *def_Dir, const wxChar *def_File, const wxChar *Filter) { wxFileDialog dlg(MDI_Get_Top_Window(), Caption, def_Dir, def_File, Filter, wxOPEN|wxFILE_MUST_EXIST); if( dlg.ShowModal() == wxID_OK ) { File_Path = dlg.GetPath(); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Save(wxString &File_Path, const wxChar *Caption, const wxChar *def_Dir, const wxChar *def_File, const wxChar *Filter) { wxFileDialog dlg(MDI_Get_Top_Window(), Caption, def_Dir, def_File, Filter, wxSAVE|wxOVERWRITE_PROMPT); if( dlg.ShowModal() == wxID_OK ) { File_Path = dlg.GetPath(); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Open(wxArrayString &File_Paths, const wxChar *Caption, const wxChar *def_Dir, const wxChar *Filter) { wxFileDialog dlg(MDI_Get_Top_Window(), Caption, def_Dir, wxT(""), Filter, wxOPEN|wxFILE_MUST_EXIST|wxMULTIPLE); if( dlg.ShowModal() == wxID_OK ) { dlg.GetPaths(File_Paths); return( File_Paths.GetCount() > 0 ); } return( false ); }
//--------------------------------------------------------- bool DLG_Get_Number(int &Value, const wxString &Caption, const wxString &Text) { long lValue; wxTextEntryDialog dlg(MDI_Get_Top_Window(), Text, Caption, wxString::Format(wxT("%d"), Value)); if( dlg.ShowModal() == wxID_OK && dlg.GetValue().ToLong(&lValue) ) { Value = lValue; return( true ); } return( false ); }
//--------------------------------------------------------- int DLG_Message_YesNoCancel(const wxString &Message, const wxString &Caption) { wxMessageDialog dlg(MDI_Get_Top_Window(), Message, Caption, wxYES|wxNO|wxCANCEL|wxICON_QUESTION); switch( dlg.ShowModal() ) { case wxID_YES: default: return( 0 ); case wxID_NO: return( 1 ); case wxID_CANCEL: return( 2 ); } }
//--------------------------------------------------------- int DLG_Maps_Add(void) { bool bOk; int i; wxString *Maps; if( g_pMaps ) { if( g_pMaps->Get_Count() <= 0 ) { return( 0 ); } else { Maps = new wxString[g_pMaps->Get_Count() + 1]; for(i=0; i<g_pMaps->Get_Count(); i++) { Maps[i] = g_pMaps->Get_Map(i)->Get_Name(); } Maps[i] = LNG("[VAL] New"); wxSingleChoiceDialog dlg( MDI_Get_Top_Window(), LNG("[CAP] Map Selection"), LNG("[DLG] Add layer to selected map"), g_pMaps->Get_Count() + 1, Maps ); dlg.SetSelection(g_pMaps->Get_Count()); bOk = dlg.ShowModal() == wxID_OK; delete[](Maps); if( bOk ) { return( dlg.GetSelection() ); } } } return( -1 ); }
//--------------------------------------------------------- bool DLG_Colors(int &Palette) { wxString Palettes[SG_COLORS_COUNT]; Palettes[SG_COLORS_DEFAULT] = LNG("default"); Palettes[SG_COLORS_DEFAULT_BRIGHT] = LNG("default (same brightness)"); Palettes[SG_COLORS_BLACK_WHITE] = LNG("greyscale"); Palettes[SG_COLORS_BLACK_RED] = LNG("black > red"); Palettes[SG_COLORS_BLACK_GREEN] = LNG("black > green"); Palettes[SG_COLORS_BLACK_BLUE] = LNG("black > blue"); Palettes[SG_COLORS_WHITE_RED] = LNG("white > red"); Palettes[SG_COLORS_WHITE_GREEN] = LNG("white > green"); Palettes[SG_COLORS_WHITE_BLUE] = LNG("white > blue"); Palettes[SG_COLORS_YELLOW_RED] = LNG("yellow > red"); Palettes[SG_COLORS_YELLOW_GREEN] = LNG("yellow > green"); Palettes[SG_COLORS_YELLOW_BLUE] = LNG("yellow > blue"); Palettes[SG_COLORS_RED_GREEN] = LNG("red > green"); Palettes[SG_COLORS_RED_BLUE] = LNG("red > blue"); Palettes[SG_COLORS_GREEN_BLUE] = LNG("green > blue"); Palettes[SG_COLORS_RED_GREY_BLUE] = LNG("red > grey > blue"); Palettes[SG_COLORS_RED_GREY_GREEN] = LNG("red > grey > green"); Palettes[SG_COLORS_GREEN_GREY_BLUE] = LNG("green > grey > blue"); Palettes[SG_COLORS_RED_GREEN_BLUE] = LNG("red > green > blue"); Palettes[SG_COLORS_RED_BLUE_GREEN] = LNG("red > blue > green"); Palettes[SG_COLORS_GREEN_RED_BLUE] = LNG("green > red > blue"); Palettes[SG_COLORS_RAINBOW] = LNG("Rainbow"); Palettes[SG_COLORS_NEON] = LNG("Neon"); wxSingleChoiceDialog dlg( MDI_Get_Top_Window(), wxT(""), LNG("[CAP] Preset Selection"), SG_COLORS_COUNT, Palettes ); if( dlg.ShowModal() == wxID_OK ) { Palette = dlg.GetSelection(); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Font(wxFont *pFont, long &_Colour) { wxColour Colour(SG_GET_R(_Colour), SG_GET_G(_Colour), SG_GET_B(_Colour)); wxFontDialog dlg(MDI_Get_Top_Window()); dlg.GetFontData().SetInitialFont(*pFont); dlg.GetFontData().SetColour(Colour); if( dlg.ShowModal() == wxID_OK ) { *pFont = dlg.GetFontData().GetChosenFont(); Colour = dlg.GetFontData().GetColour(); _Colour = Get_Color_asInt(Colour); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Color(long &_Colour) { static wxColourData Colours; Colours.SetChooseFull(true); wxColour Colour(SG_GET_R(_Colour), SG_GET_G(_Colour), SG_GET_B(_Colour)); wxColourDialog dlg(MDI_Get_Top_Window(), &Colours); dlg.GetColourData().SetColour(Colour); if( dlg.ShowModal() == wxID_OK ) { Colours = dlg.GetColourData(); Colour = dlg.GetColourData().GetColour(); _Colour = Get_Color_asInt(Colour); return( true ); } return( false ); }
//--------------------------------------------------------- bool DLG_Font(CSG_Parameter *pFont) { wxFont Font; wxColour Colour; if( Set_Font(pFont, Font, Colour) ) { wxFontDialog dlg(MDI_Get_Top_Window()); dlg.GetFontData().SetInitialFont(Font); dlg.GetFontData().SetColour (Colour); if( dlg.ShowModal() == wxID_OK ) { Font = dlg.GetFontData().GetChosenFont(); Colour = dlg.GetFontData().GetColour(); return( Set_Font(Font, Colour, pFont) ); } } return( false ); }
//--------------------------------------------------------- bool DLG_Message_Confirm(const wxString &Message, const wxString &Caption) { wxMessageDialog dlg(MDI_Get_Top_Window(), Message, Caption, wxYES_NO|wxICON_EXCLAMATION); return( dlg.ShowModal() == wxID_YES ); }
//--------------------------------------------------------- bool DLG_Message_Confirm(const wxChar *Message, const wxChar *Caption) { wxMessageDialog dlg(MDI_Get_Top_Window(), Message, Caption, wxYES_NO|wxICON_QUESTION); return( dlg.ShowModal() == wxID_YES ); }
//--------------------------------------------------------- void DLG_Message_Show(const wxString &Message, const wxString &Caption) { wxMessageDialog dlg(MDI_Get_Top_Window(), Message, Caption, wxOK); dlg.ShowModal(); }
//--------------------------------------------------------- bool DLG_Get_Number(double &Value, const wxString &Caption, const wxString &Text) { wxTextEntryDialog dlg(MDI_Get_Top_Window(), Text, Caption, wxString::Format(wxT("%f"), Value)); return( dlg.ShowModal() == wxID_OK && dlg.GetValue().ToDouble(&Value) ); }