LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, const wxString& aLibraryName ) : SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Symbol Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_STYLE_MODAL : LIB_VIEW_STYLE, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_NAME_MODAL : LIB_VIEW_NAME ), m_libList( nullptr ), m_cmpList( nullptr ), m_previewItem( nullptr ) { wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL ); if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); // Force the frame name used in config. the lib viewer frame has a name // depending on aFrameType (needed to identify the frame by wxWidgets), // but only one configuration is preferable. m_configFrameName = LIB_VIEW_NAME; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) ); SetIcon( icon ); m_hotkeysDescrList = g_Viewlib_Hotkeys_Descr; m_libListWidth = 200; m_cmpListWidth = 300; m_listPowerCmpOnly = false; SetShowElectricalType( true ); // Initialize grid id to the default value (50 mils): m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; SetScreen( new SCH_SCREEN( aKiway ) ); GetScreen()->m_Center = true; // Axis origin centered on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Menu bar is not mandatory: uncomment/comment the next line // to add/remove the menubar ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL | wxNO_BORDER ); m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL | wxNO_BORDER ); if( aLibraryName.empty() ) { ReCreateListLib(); } else { m_libraryName = aLibraryName; m_entryName.Clear(); m_unit = 1; m_convert = 1; } m_selection_changed = false; DisplayLibInfos(); m_auimgr.SetManagedWindow( this ); m_auimgr.SetArtProvider( new EDA_DOCKART( this ) ); // Manage main toolbar m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); m_auimgr.AddPane( m_libList, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(3) .CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_libListWidth, -1 ) ); m_auimgr.AddPane( m_cmpList, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1) .CaptionVisible( false ).MinSize( 80, -1 ).BestSize( m_cmpListWidth, -1 ) ); m_auimgr.AddPane( m_canvas->GetWindow(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() ); m_auimgr.GetPane( m_libList ).Show( aLibraryName.empty() ); m_auimgr.Update(); setupTools(); GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId ); GetToolManager()->RunAction( "common.Control.zoomFitScreen", true ); if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame { Raise(); Show( true ); } SyncView(); GetGalCanvas()->GetViewControls()->SetSnapping( true ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() ); // Set the working/draw area size to display a symbol to a reasonable value: // A 450mm x 450mm with a origin at the area center looks like a large working area double max_size_x = Millimeter2iu( 450 ); double max_size_y = Millimeter2iu( 450 ); BOX2D bbox; bbox.SetOrigin( -max_size_x /2, -max_size_y/2 ); bbox.SetSize( max_size_x, max_size_y ); GetCanvas()->GetView()->SetBoundary( bbox ); }
VariableEditor::VariableEditor(ExpressionEditor *_editor, ScriptGlobals *_globals) : Panel("VariableEditor", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_VARIABLEEDITOR); editor = _editor; globals = _globals; Text *text; Button *button; int y; //Title text = AddText("User Variables", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText("Variables: ", 10, y); listVars = AddListPop(text->Right() + 2, text->Top(), 300); listVars->SetToolTip(TIP_VARIABLEEDITOR_VARIABLES); button = AddButton("Add", listVars->Left(), listVars->Down() + 2, 0, 0, BT_ADD); button->SetToolTip(TIP_VARIABLEEDITOR_ADD); button = AddButton("Edit", button->Right(), button->Top(), 0, 0, BT_EDIT); button->SetToolTip(TIP_VARIABLEEDITOR_EDIT); button = AddButton("Remove", button->Right(), button->Top(), 0, 0, BT_REMOVE); button->SetToolTip(TIP_VARIABLEEDITOR_REMOVE); //Close y = DrawHLine(button->Down() + 4); button = AddButton("Close", (WIDTH - 60)/2, y, 0, 0, BT_CLOSE); UpdateVars(); }
DlgPocketPCKey::DlgPocketPCKey(SDLKey _keyFrom) : Panel("DlgPocketPCKey", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); key = SDLK_UNKNOWN; keyFrom = _keyFrom; Text *text; Button *button; int y; //Title text = AddText("PocketPC Key Mapper", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText(gedString("Redirect ") + SDL_GetKeyName(keyFrom), 10, y); text = AddText("Press key to redirect: ", 10, text->Down()+1); textKey = AddText(" ", text->Right(), text->Top()); //Close y = DrawHLine(textKey->Down() + 2); button = AddButton("Set Key", (WIDTH-135)/2, y, 0, 0, BT_SET); button = AddButton("Close", button->Right() + 10, y, 0, 0, BT_CANCEL); }
DestroyTimer::DestroyTimer(Actor *actor) : BaseAction("Destroy Timer", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_DESTROYTIMER); eventActor = actionActor = actor; Text *text; Button *button; int y; //Title text = AddText(DESTROY_TIMER, CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText(" Timer: ", 10, y); listTimer = AddListPop(text->Right() + 2, text->Top(), 300, 0, LS_TIMER); listTimer->SetToolTip(TIP_DESTROYTIMER_TIMER); //Close y = DrawHLine(listTimer->Down() + 2); button = AddButton(Action::getEditAction()?"Ok":"Add", (WIDTH-135)/2, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); SetCancelButton(button); GameControl::Get()->PopulateTimers(listTimer); listTimer->SetItem(listTimer->GetText(0)); if(!ExpressionEditor::getExpressionEditor()) UpdateEdition(); }
CapriceLoadSave::CapriceLoadSave(const CRect& WindowRect, CWindow* pParent, CFontEngine* pFontEngine) : CFrame(WindowRect, pParent, pFontEngine, "Load / Save", false) { SetModal(true); // Make this window listen to incoming CTRL_VALUECHANGE messages (used for updating drop down values) CMessageServer::Instance().RegisterMessageClient(this, CMessage::CTRL_VALUECHANGE); CMessageServer::Instance().RegisterMessageClient(this, CMessage::CTRL_VALUECHANGING); // File type (.SNA, .DSK, .TAP, .VOC) m_pTypeLabel = new CLabel( CPoint(15, 25), this, "File type: "); m_pTypeValue = new CDropDown( CRect(CPoint(80, 20), 150, 20), this, false); #ifndef WITH_IPF m_pTypeValue->AddItem(SListItem("Drive A (.dsk)")); m_pTypeValue->AddItem(SListItem("Drive B (.dsk)")); #else m_pTypeValue->AddItem(SListItem("Drive A (.dsk/.ipf)")); m_pTypeValue->AddItem(SListItem("Drive B (.dsk/.ipf)")); #endif m_pTypeValue->AddItem(SListItem("Snapshot (.sna)")); m_pTypeValue->AddItem(SListItem("Tape (.cdt/.voc)")); m_pTypeValue->AddItem(SListItem("Cartridge (.cpr)")); m_pTypeValue->SetListboxHeight(5); m_pTypeValue->SelectItem(0); m_pTypeValue->SetIsFocusable(true); m_fileSpec = { ".dsk", ".zip" }; // Action: load / save m_pActionLabel = new CLabel( CPoint(15, 55), this, "Action: "); m_pActionValue = new CDropDown( CRect(CPoint(80, 50), 150, 20), this, false); m_pActionValue->AddItem(SListItem("Load")); m_pActionValue->AddItem(SListItem("Save")); m_pActionValue->SetListboxHeight(2); m_pActionValue->SelectItem(0); m_pActionValue->SetIsFocusable(true); // Directory m_pDirectoryLabel = new CLabel( CPoint(15, 85), this, "Directory: "); m_pDirectoryValue = new CEditBox( CRect( CPoint(80, 80), 150, 20), this); m_pDirectoryValue->SetWindowText(simplifyDirPath(CPC.current_dsk_path)); m_pDirectoryValue->SetReadOnly(true); // File list m_pFilesList = new CListBox(CRect(CPoint(80, 115), 150, 80), this, true, 12); m_pFilesList->SetIsFocusable(true); UpdateFilesList(); // File name m_pFileNameLabel = new CLabel( CPoint(15, 215), this, "File: "); m_pFileNameValue = new CEditBox( CRect( CPoint(80, 210), 150, 20), this); m_pFileNameValue->SetWindowText(""); m_pFileNameValue->SetReadOnly(true); // Buttons m_pCancelButton = new CButton( CRect( CPoint(250, 180), 50, 20), this, "Cancel"); m_pCancelButton->SetIsFocusable(true); m_pLoadSaveButton = new CButton( CRect( CPoint(250, 210), 50, 20), this, "Load"); m_pLoadSaveButton->SetIsFocusable(true); }
// Replacement for Show(true) for modal dialogs - returns return code int wxDialog::ShowModal() { if ( !m_isModalStyle ) SetModal(true); Show(true); return GetReturnCode(); }
// Replacement for Show(TRUE) for modal dialogs - returns return code int wxDialog::ShowModal() { if ( !IsModal() ) { SetModal(TRUE); } Show(TRUE); return GetReturnCode(); }
OptionWindow::OptionWindow() : GUIWindow(), nextMode(OPTION_MODE_OPTION), current(NULL), option(NULL), video(NULL), audio(NULL) { SetDimension(500, 550); SetModal(true); }
bool Dialog::CreateFromXML(const char* idd){ ScopedPointer<File> fh = gUiRender->OpenFile(idd); if(!fh) return false; char* xml = (char*)fh->ReadWholeFile(); int tmpInt; bool result = true; try { ticpp::Document doc; doc.Parse(xml); ticpp::Element* root = doc.FirstChildElement("Root_Element"); if(root->GetAttribute("ID", &tmpInt)) SetID(tmpInt); if(root->GetAttribute("X", &tmpInt)) SetPositionX(tmpInt); if(root->GetAttribute("Y", &tmpInt)) SetPositionY(tmpInt); if(root->GetAttribute("WIDTH", &tmpInt)) SetSizeX(tmpInt); if(root->GetAttribute("HEIGHT", &tmpInt)) SetSizeY(tmpInt); if(root->GetAttribute("MODAL", &tmpInt)) SetModal(tmpInt); if(root->GetAttribute("SHOWSID", &tmpInt)) SetShowSoundID(tmpInt); if(root->GetAttribute("HIDESID", &tmpInt)) SetHideSoundID(tmpInt); if(root->GetAttribute("EXTENT", &tmpInt)) SetExtent(tmpInt); if(root->GetAttribute("DEFAULT_X", &tmpInt)) SetDefaultPositionX(tmpInt); if(root->GetAttribute("DEFAULT_Y", &tmpInt)) SetDefaultPositionY(tmpInt); if(root->GetAttribute("ADJUST_X", &tmpInt)) SetDefaultAdjustPositionX(tmpInt); if(root->GetAttribute("ADJUST_Y", &tmpInt)) SetDefaultAdjustPositionY(tmpInt); if(root->GetAttribute("DEFAULT_VISIBLE", &tmpInt)) SetDefaultVisible(tmpInt); SetName(root->GetAttribute("NAME").c_str()); for(ticpp::Element* child = root->FirstChildElement(false); child; child = child->NextSiblingElement(false)){ if(child->Value() == "CAPTION"){ mCaption = (Caption*)CreateControlFromXML(child, this); }else if(child->Value() == "RADIOBUTTON"){ RadioButton* btn = (RadioButton*)CreateControlFromXML(child, this); if(int id = btn->RadioBoxID()){ RadioBox* box = (RadioBox*)GetControlByID(id); if(box && box->ControlType() == CT_RADIOBOX) box->AddButton(btn); } AddChild(btn); }else{ AddChild(CreateControlFromXML(child, this)); } } }catch(ticpp::Exception& ex){ LOG("TinyXML Exception %s", ex.what()); result = false; } OnCreated(); delete [] xml; return result; }
DlgPathFinish::DlgPathFinish(Actor *actor) : Panel("DlgAnimationFinish", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_DLG_PATH_FINISH); eventActor = actionActor = actor; Text *text; Button *button; Actor *add; int y; //Title text = AddText("Path Finish Event", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText("Path: ", 10, y); listPath = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ANIMATION); listPath->SetToolTip(TIP_DLG_PATHFINISH_PATH); //Close y = DrawHLine(listPath->Down() + 5); if(Action::inNewActivationEvent()) { add = AddButton("Choose Actor", 25, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE); } else if(Action::getEditAction()) { add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT); } else { add = AddListPop(30, y, 85, 0, LS_ACTION, "Add Action"); ((ListPop *)add)->SetToolTip(TIP_ADDACTION); Action::Populate((ListPop *)add); } if(Action::getEditAction()) { button = AddButton("Cancel", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL); } else { button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE); } GameControl::Get()->PopulatePaths(listPath, false); listPath->AddText(ANY_PATH); listPath->SetItem(ANY_PATH); UpdateEdition(); }
DlgTimer::DlgTimer(Actor *actor) : Panel("DlgTimer", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_DLG_TIMER); eventActor = actionActor = actor; Text *text; Button *button; Actor *add; int y; //Title text = AddText("Timer Event", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText(" Timer: ", 10, y); listTimer = AddListPop(text->Right() + 2, text->Top(), 300, 0, LS_TIMER); //Close y = DrawHLine(listTimer->Down() + 5); if(Action::inNewActivationEvent()) { add = AddButton("Choose Actor", (WIDTH-135)/2 - 15, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE); } else if(Action::getEditAction()) { add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT); } else { add = AddListPop((WIDTH-135)/2 - 10, y, 85, 0, LS_ACTION, "Add Action"); ((ListPop *)add)->SetToolTip(TIP_ADDACTION); Action::Populate((ListPop *)add); } if(Action::getEditAction()) { button = AddButton("Cancel", add->Right() + 10, y, 0, 0, BT_CANCEL); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL); } else { button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CANCEL); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE); } GameControl::Get()->PopulateTimers(listTimer); listTimer->Sort(); //listTimer->SetItem(listTimer->GetText(0)); UpdateEdition(); }
ToMousePosition::ToMousePosition(Actor *actor, bool bOnCollision) : BaseAction("To Mouse Position", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_FOLLOW_MOUSE); this->eventActor = actionActor = actor; Text *text; Button *button; int y; //Title text = AddText(FOLLOW_MOUSE, CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText("Actor: ", 10, y); listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(gedString(TIP_FOLLOW_MOUSE_ACTOR) + TIP_ACTION_ACTOR); text = AddText(" Axis: ", 10, listActor->Down()); listAxis = AddListPop(text->Right() + 2, text->Top(), 128); listAxis->SetToolTip(TIP_FOLLOW_MOUSE_AXIS); //Close y = DrawHLine(listAxis->Down() + 2); button = AddButton(Action::getEditAction()?"Ok":"Add", 45, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); SetCancelButton(button); GameControl::Get()->PopulateActors(listActor); listActor->AddText(S_EVENT_ACTOR); if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { listActor->AddText(S_PARENT_ACTOR); listActor->AddText(S_CREATOR_ACTOR); } if(bOnCollision) listActor->AddText(S_COLLIDE_ACTOR); listActor->SetItem(S_EVENT_ACTOR); listAxis->AddText("Both"); listAxis->AddText("x"); listAxis->AddText("y"); listAxis->AddText("none"); listAxis->SetItem("Both"); if(!ExpressionEditor::getExpressionEditor()) UpdateEdition(); }
void LoadSave::Init(int command, gedString title, gedString confirmButtonText) { SetModal(); this->command = command; Text *text; Button *button; int y; text = AddText(title, CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); if(command == SAVE_DIALOG) { SetToolTip(TIP_SAVE); text = AddText("File: ", 10, y); name = AddEditBox(text->Right(), text->Top(), 200); dir = AddListDirectory(name->Right() + 2, y, 80, 0, 0, "select"); dir->SetToolTip(TIP_SAVE_FILE); dir->SetSave(); y = name->Down(); } else if(command == LOAD_DIALOG) { SetToolTip(TIP_LOAD); text = AddText("File: ", 40, y); dir = AddListDirectory(text->Right(), y, 200, 0, 0); dir->SetToolTip(TIP_LOAD_FILE); y = dir->Down(); } else if(command == MERGE_DIALOG) { SetToolTip(TIP_MERGE); text = AddText("File: ", 40, y); dir = AddListDirectory(text->Right(), y, 200, 0, 0); dir->SetToolTip(TIP_MERGE_FILE); y = dir->Down(); command = LOAD_DIALOG; } //Close y = DrawHLine(Height() - 40); button = AddButton(confirmButtonText, (WIDTH-135)/2, y, 0, 0, LOADSAVE_OK); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, LOADSAVE_CLOSE); SetCancelButton(button); chdir(GameControl::Get()->getGamePath().c_str()); }
SetZDepth::SetZDepth(Actor *actor, bool bOnCollision) : BaseAction("Set ZDepth", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_CHANGE_ZDEPTH); eventActor = actionActor = actor; Text *text; Button *button; int y; //Title text = AddText(CHANGE_ZDEPTH, CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText(" Actor: ", 10, y); listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(gedString(TIP_CHANGE_ZDEPTH_ACTOR) + TIP_ACTION_ACTOR); text = AddText(" Z Depth: ", 10, listActor->Down() + 2); slide = AddSlide(text->Right(), text->Top(), 100, 14, SL_TRANS); slide->SetToolTip(TIP_CHANGE_ZDEPTH_AMOUNT); //Close y = DrawHLine(slide->Down() + 2); button = AddButton(Action::getEditAction()?"Ok":"Add", 55, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); SetCancelButton(button); GameControl::Get()->PopulateActors(listActor); listActor->AddText(S_EVENT_ACTOR); if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { listActor->AddText(S_PARENT_ACTOR); listActor->AddText(S_CREATOR_ACTOR); } if(bOnCollision) listActor->AddText(S_COLLIDE_ACTOR); listActor->SetItem(S_EVENT_ACTOR); oriZDepth = actionActor->getImage()->ZDepth(); if(!ExpressionEditor::getExpressionEditor()) UpdateEdition(); }
void wxDialog::EndModal(int retCode) { if (!m_modalShowing) return; SetReturnCode(retCode); // Strangely, we don't seem to need this now. // XtRemoveGrab((Widget) m_mainWidget); Show(false); m_modalShowing = false; m_eventLoop->Exit(); SetModal(false); }
CP3DGUI_Emitter::CP3DGUI_Emitter() { char title[30]; sprintf(title, "%s 1", g_pLocaliz->Translate_const("#GUI_PEditEmitter") ); CreateWindow(title, 0, 0, 400, 250, P3DWS_CAPTION | P3DWS_CLOSEBTN); CenterScreen(); SetModal(); m_lstFolders.CreateListBox(10, 10, 185, 184, this); m_lstFiles.CreateListBox(205, 10, 185, 184, this); m_lblPath.CreateLabel("...\\Cesta\\Cesta\\cesta\\cesta", 10, 198, 380, 20, false, LA_SINGLELINE | LA_RIGHT, this); m_txtFilename.CreateTextBox("pokus.dat", 10, 217, 185, 22, this); m_btnCancel.CreateButton(g_pLocaliz->Translate_const("#GUI_Cancel"), 303, 216, 87, 24, this); m_btnOK.CreateButton(g_pLocaliz->Translate_const("#GUI_Ok"), 205, 216, 87, 24, this); onOK = false; SetPath("C:\\"); }
ColorPicker::ColorPicker(int _r, int _g, int _b) : Panel("DlgColorPicker", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); Text *text; Button *button; //Title text = AddText("Color Picker", CENTER_TEXT, 5); int y = DrawHLine(text->Down() + 2); //Body canvas = new ColorCanvas(this); oldColor = new ColorSampleOfPicker(this); newColor = new ColorSampleOfPicker(this); canvas->SetPos(10, y + 2); colorSlide = AddSlide(canvas->Right() + 5, canvas->Top(), 20, 256, SL_COLOR); colorSlide->SetPos(1.0); newColor->SetPos(colorSlide->Right() + 5, colorSlide->Top()); oldColor->SetPos(newColor->Left(), newColor->Down()); text = AddText(" Red: ", oldColor->Left(), oldColor->Down() + 16); rEdit = AddEditBox(text->Right(), text->Top(), 32); rEdit->SetNumeric(0, 255, 1); text = AddText(" Green: ", text->Left(), rEdit->Down() + 2); gEdit = AddEditBox(text->Right(), text->Top(), 32); gEdit->SetNumeric(0, 255, 1); text = AddText(" Blue: ", text->Left(), gEdit->Down() + 2); bEdit = AddEditBox(text->Right(), text->Top(), 32); bEdit->SetNumeric(0, 255, 1); text = AddText(" Hue: ", text->Left(), bEdit->Down() + 16); hEdit = AddEditBox(text->Right(), text->Top(), 32); hEdit->SetNumeric(0, 359, 1); text = AddText("Saturation: ", text->Left(), hEdit->Down() + 2); sEdit = AddEditBox(text->Right(), text->Top(), 32); sEdit->SetNumeric(0, 100, 1); text = AddText("Brightness: ", text->Left(), sEdit->Down() + 2); vEdit = AddEditBox(text->Right(), text->Top(), 32); vEdit->SetNumeric(0, 100, 1); listFix = AddListPop(oldColor->Left(), vEdit->Down() + 16, 104, 0, LS_FIX_COLOR); //Close y = DrawHLine(canvas->Down() + 2); button = AddButton("Ok", (WIDTH-135)/2, y, 0, 0, OK_BUTTON); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, CANCEL_BUTTON); SetCancelButton(button); listFix->AddText("Red"); listFix->AddText("Green"); listFix->AddText("Blue"); listFix->AddText("Hue"); listFix->AddText("Saturation"); listFix->AddText("Brightness"); listFix->SetText("Red"); fixedColor = FIX_RED; r = _r; g = _g; b = _b; oldColor->SetColor(r, g, b); colorSlide->SetPos(r / 255.0); UpdateSample(r, g, b); UpdateCanvas(r, fixedColor); UpdateSlideColor(r, g, b, fixedColor); }
ExpressionEditor::ExpressionEditor(Actor *actor, bool bOnCollision) : BaseAction("Expression Editor", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { expressionEditor = this; SetModal(); SetToolTip(TIP_SCRIPTEDITOR); eventActor = actionActor = actor; this->bOnCollision = bOnCollision; Text *text; Button *button; int y; //Title: Script Editor: oi -> Key Down (left) gedString title(EXPRESSION_EDITOR), actionDesc; title += ": "; actionDesc = actor->getActorName(); actionDesc += " -> "; editAction = Action::getEditAction(); if(editAction) { actionDesc += Action::GetDescription(editAction, false); MainPanel::AddLastScript(actionDesc); } else { stAction tmp; tmp.eventData = Action::getActualEvent(); actionDesc += Action::GetDescription(&tmp, false); } title += actionDesc; text = AddText(title, CENTER_TEXT, 5); textLine = AddText("Ln 1 ", WIDTH-45, 5, ALIGN_LEFT); y = DrawHLine(text->Down() + 2); //Body editExp = AddEditBox(10, y, WIDTH-34, HEIGHT-85, true); listActor = AddListPop(10, editExp->Down()+4, 120, 0, LS_ACTOR, "actors"); listActor->SetToolTip(TIP_SCRIPTEDITOR_ACTORS); listAutoComplete = AddListPop(listActor->Right(), listActor->Top(), 215, 0, LS_COMPLETE, "variables/functions"); listAutoComplete->SetToolTip(TIP_SCRIPTEDITOR_VARIABLES_FUNCTIONS); button = AddButton("Variables", listAutoComplete->Right(), listAutoComplete->Top(), 0, 0, BT_CREATEVAR); button->SetToolTip(TIP_SCRIPTEDITOR_VARIABLES); button = AddButton("Global code", button->Right(), button->Top(), 0, 0, BT_GLOBALS); button->SetToolTip(TIP_SCRIPTEDITOR_GLOBALCODE); listFile = AddListPop(button->Right() + 2, button->Top(), 64, 0, LS_FILE, "File"); listFile->SetToolTip(TIP_SCRIPTEDITOR_FILE); //button = AddButton("Web", listFile->Right() + 2, listFile->Top(), 35, 0, BT_WEB); button->SetToolTip(TIP_SCRIPTEDITOR_WEB); //Close y = DrawHLine(listAutoComplete->Down() + 2); button = AddButton(Action::getEditAction()?"Ok":"Add", WIDTH/2 - 65, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); //Don't exit on ESC (crash the editor) //Populate actors GameControl::Get()->PopulateActors(listActor); if(bOnCollision) listActor->AddText("collide"); UpdateVars(); listFile->AddText("Save"); listFile->AddText("Load"); bDelimit = false; editExp->SetSyntaxColorize(true); editExp->ShowScrollBar(); pScript = NULL; UpdateEdition(); if(!pScript) pScript = new Script(); }
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, CMP_LIBRARY* aLibrary ) : SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType==FRAME_SCH_VIEWER ? KICAD_DEFAULT_DRAWFRAME_STYLE : KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT, GetLibViewerFrameName() ) { wxASSERT( aFrameType==FRAME_SCH_VIEWER || aFrameType==FRAME_SCH_VIEWER_MODAL ); if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); m_FrameName = GetLibViewerFrameName(); m_configPath = wxT( "LibraryViewer" ); // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) ); SetIcon( icon ); m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr; m_cmpList = NULL; m_libList = NULL; SetScreen( new SCH_SCREEN() ); GetScreen()->m_Center = true; // Axis origin centered on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Initialize grid id to the default value (50 mils): m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ReCreateHToolbar(); ReCreateVToolbar(); wxSize size = GetClientSize(); size.y -= m_MsgFrameHeight + 2; wxPoint win_pos( 0, 0 ); if( !aLibrary ) { // Creates the libraries window display m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxPoint( 0, 0 ), wxSize(m_libListWidth, -1), 0, NULL, wxLB_HSCROLL ); } else { m_libraryName = aLibrary->GetName(); m_entryName.Clear(); m_unit = 1; m_convert = 1; m_libListWidth = 0; } // Creates the component window display win_pos.x = m_libListWidth; m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ), wxSize(m_cmpListWidth, -1), 0, NULL, wxLB_HSCROLL ); if( m_libList ) ReCreateListLib(); DisplayLibInfos(); if( m_canvas ) m_canvas->SetAcceleratorTable( table ); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO info; info.InfoToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Manage main toolbal m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) ); // Manage the left window (list of libraries) if( m_libList ) m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ). Left().Row( 0 ) ); // Manage the list of components) m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( wxT( "m_cmpList" ) ). Left().Row( 1 ) ); // Manage the draw panel m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); // Manage the message panel m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); /* Now the minimum windows are fixed, set library list * and component list of the previous values from last viewlib use */ if( m_libList ) { m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_libList ).BestSize( wxSize(m_libListWidth, -1) ); } m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_cmpList ).BestSize(wxSize(m_cmpListWidth, -1) ); m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) #ifdef USE_WX_GRAPHICS_CONTEXT GetScreen()->SetZoom( BestZoom() ); #else Zoom_Automatique( false ); #endif Show( true ); }
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) : PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT : KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintViewerFrameName() ) { wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL ); if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ) SetModal( true ); wxAcceleratorTable table( DIM( accels ), accels ); m_FrameName = GetFootprintViewerFrameName(); m_configPath = wxT( "FootprintViewer" ); m_showAxis = true; // true to draw axis. // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( modview_icon_xpm ) ); SetIcon( icon ); m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL ); m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL ); SetBoard( new BOARD() ); // Ensure all layers and items are visible: GetBoard()->SetVisibleAlls(); SetScreen( new PCB_SCREEN( GetPageSizeIU() ) ); GetScreen()->m_Center = true; // Center coordinate origins on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ReCreateHToolbar(); ReCreateVToolbar(); ReCreateLibraryList(); UpdateTitle(); // If a footprint was previously loaded, reload it if( getCurNickname().size() && getCurFootprintName().size() ) { FPID id; id.SetLibNickname( getCurNickname() ); id.SetFootprintName( getCurFootprintName() ); GetBoard()->Add( loadFootprint( id ) ); } if( m_canvas ) m_canvas->SetAcceleratorTable( table ); m_auimgr.SetManagedWindow( this ); wxSize minsize(100,-1); // Min size of list boxes // Main toolbar is initially docked at the top of the main window and dockable on any side. // The close button is disable because the footprint viewer has no main menu to re-enable it. // The tool bar will only be dockable on the top or bottom of the main frame window. This is // most likely due to the fact that the other windows are not dockable and are preventing the // tool bar from docking on the right and left. wxAuiPaneInfo toolbarPaneInfo; toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false ); EDA_PANEINFO info; info.InfoToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Manage main toolbar, top pane m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo ); // Manage the list of libraries, left pane. m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ) .Left().Row( 1 ).MinSize( minsize ) ); // Manage the list of footprints, center pane. m_auimgr.AddPane( m_footprintList, wxAuiPaneInfo( info ).Name( wxT( "m_footprintList" ) ) .Left().Row( 2 ).MinSize( minsize ) ); // Manage the draw panel, right pane. m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); // Manage the message panel, bottom pane. m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); if( !m_perspective.IsEmpty() ) { // Restore last saved sizes, pos and other params // However m_mainToolBar size cannot be set to its last saved size // because the actual size change depending on the way modview was called: // the tool to export the current footprint exist or not. // and the saved size is not always OK // the trick is to get the default toolbar size, and set the size after // calling LoadPerspective wxSize tbsize = m_mainToolBar->GetSize(); m_auimgr.LoadPerspective( m_perspective, false ); m_auimgr.GetPane( m_mainToolBar ).BestSize( tbsize ); } #if 0 // no. // Set min size (overwrite params read in LoadPerspective(), if any) m_auimgr.GetPane( m_libList ).MinSize( minsize ); m_auimgr.GetPane( m_footprintList ).MinSize( minsize ); #endif // after changing something to the aui manager, // call Update()() to reflect the changes m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) #ifdef USE_WX_GRAPHICS_CONTEXT GetScreen()->SetZoom( BestZoom() ); #else Zoom_Automatique( false ); #endif Show( true ); }
CreateActor::CreateActor(Actor *actor, bool bOnCollision) : BaseAction("Create Actor", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_CREATEACTOR); this->eventActor = actionActor = actor; Text *text; Button *button; int y; //Title text = AddText(CREATE_ACTOR, CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText(" Actor: ", 10, y); listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_CREATEACTOR_ACTOR); text = AddText("Animation: ", 10, listActor->Down()); listAnimation = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ANIMATION); listAnimation->SetToolTip(TIP_CREATEACTOR_ANIMATION); text = AddText(" Parent: ", 10, listAnimation->Down()); listParent = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_PARENT); listParent->SetToolTip(TIP_CREATEACTOR_PARENT); text = AddText(" Path: ", 10, listParent->Down()); listPath = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_PATH); listPath->SetToolTip(TIP_CREATEACTOR_PATH); text = AddText("Initial position: ", 10, listPath->Down() + 4); text = AddText("x", 10, text->Down()); posX = AddEditBox(text->Right() + 2, text->Top(), 50); posX->SetNumeric(-650000, 650000, 1); text = AddText("y", posX->Right()+5, posX->Top()); posY = AddEditBox(text->Right() + 4, text->Top(), 50); posY->SetNumeric(-650000, 650000, 1); text = AddText("Relative to creator: ", 10, posY->Down() + 2); listRelativePos = AddListPop(text->Right() + 2, text->Top(), 40, 0, LS_RELATIVEPOS); listRelativePos->SetToolTip(TIP_CREATEACTOR_RELATIVE); //Close y = DrawHLine(listRelativePos->Down() + 2); button = AddButton(Action::getEditAction()?"Ok":"Add", (WIDTH-135)/2, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); SetCancelButton(button); posX->SetText(0); posY->SetText(0); GameControl::Get()->PopulateActors(listActor, false); listActor->RemoveText(VIEW_NAME); GameControl::Get()->PopulateAnimations(actionActor, listAnimation); GameControl::Get()->PopulateActors(listParent); listParent->AddText(NO_PARENT); listParent->AddText(S_EVENT_ACTOR); if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { listParent->AddText(S_PARENT_ACTOR); listParent->AddText(S_CREATOR_ACTOR); } if(bOnCollision) listParent->AddText(S_COLLIDE_ACTOR); GameControl::Get()->PopulatePaths(listPath); if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { //Set default only in old tutorials listActor->SetItem(actionActor->getActorName()); } else { //Don't select animations in new version listAnimation->RemoveAll(); listAnimation->SetItem(-1); } listParent->SetItem(NO_PARENT); listPath->SetItem(NO_PATH); listRelativePos->AddText("Yes"); listRelativePos->AddText("No"); listRelativePos->SetItem("Yes"); if(!ExpressionEditor::getExpressionEditor()) UpdateEdition(); }
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType, PART_LIB* aLibrary ) : SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType==FRAME_SCH_VIEWER_MODAL ? #ifdef __WINDOWS__ KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP #else aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP #endif : KICAD_DEFAULT_DRAWFRAME_STYLE, aFrameType == FRAME_SCH_VIEWER_MODAL ? LIB_VIEW_FRAME_NAME_MODAL : LIB_VIEW_FRAME_NAME ) { wxASSERT( aFrameType == FRAME_SCH_VIEWER || aFrameType == FRAME_SCH_VIEWER_MODAL ); if( aFrameType == FRAME_SCH_VIEWER_MODAL ) SetModal( true ); // Force the frame name used in config. the lib viewer frame has a name // depending on aFrameType (needed to identify the frame by wxWidgets), // but only one configuration is preferable. m_configFrameName = LIB_VIEW_FRAME_NAME; // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) ); SetIcon( icon ); m_hotkeysDescrList = g_Viewlib_Hokeys_Descr; m_cmpList = NULL; m_libList = NULL; m_listPowerCmpOnly = false; SetScreen( new SCH_SCREEN( aKiway ) ); GetScreen()->m_Center = true; // Axis origin centered on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); // Initialize grid id to the default value (50 mils): m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000; GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); // Menu bar is not mandatory: uncomment/comment the next line // to add/remove the menubar ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); if( !aLibrary ) { // Creates the libraries window display m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxPoint( 0, 0 ), wxSize(m_libListWidth, -1), 0, NULL, wxLB_HSCROLL ); } else { m_libraryName = aLibrary->GetName(); m_entryName.Clear(); m_unit = 1; m_convert = 1; m_libListWidth = 0; } // Creates the component window display m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( 0, 0 ), wxSize(m_cmpListWidth, -1), 0, NULL, wxLB_HSCROLL ); if( m_libList ) ReCreateListLib(); DisplayLibInfos(); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiz; horiz.HorizontalToolbarPane(); EDA_PANEINFO vert; vert.VerticalToolbarPane(); EDA_PANEINFO info; info.InfoToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Manage main toolbal m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) ); // Manage the left window (list of libraries) if( m_libList ) m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ). Left().Row( 0 ) ); // Manage the list of components) m_auimgr.AddPane( m_cmpList, wxAuiPaneInfo( info ).Name( wxT( "m_cmpList" ) ). Left().Row( 1 ) ); // Manage the draw panel m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); // Manage the message panel m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) ); /* Now the minimum windows are fixed, set library list * and component list of the previous values from last viewlib use */ if( m_libList ) { m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_libList ).BestSize( wxSize(m_libListWidth, -1) ); } m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) ); m_auimgr.GetPane( m_cmpList ).BestSize(wxSize(m_cmpListWidth, -1) ); m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) #ifdef USE_WX_GRAPHICS_CONTEXT GetScreen()->SetZoom( BestZoom() ); #else Zoom_Automatique( false ); #endif if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame { Raise(); Show( true ); } }
TutorialReminder::TutorialReminder() : Panel("TutorialReminder", (GameControl::Get()->Width() - (WIDTH_REMINDER - 85))/2, (GameControl::Get()->Height() - HEIGHT_REMINDER)/2, WIDTH_REMINDER, HEIGHT_REMINDER) { SetModal(); bAlreadyShow = true; chdir((GameControl::getEditorPath() + DIR_SEP + "Tutorials" + DIR_SEP + "Getting Started").c_str()); Text *text; Button *button; int y; //Title text = AddText("Welcome", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText("Thank you for choosing Game Editor\nFor a quick start, select a option below:", 30, y); //Create a new game y = DrawHLine(text->Down() + 10); text = AddText("Create a new game:", 30, y); button = AddButton("Create now", 58, text->Down() + 10, 0, 0, BT_NEWGAME); //Demos y = DrawHLine(button->Down() + 5); text = AddText("Get game demos:", 30, y); button = AddButton("Go to demo page", 58, text->Down() + 10, 0, 0, BT_DEMOS); //Tutorials y = DrawHLine(button->Down() + 5); text = AddText("See the tutorials:", 30, y); listTutorialDir = AddListDirectory(10, text->Down() + 10, 0, 0, LS_TUTORIAL, " Click here for the tutorials "); listTutorialDir->setCanUseSystemFileDialog(false); #if defined(WIN32) && !defined(GAME_EDITOR_HOME_EDITION) button = AddButton("Get the newest tutorials", 58, listTutorialDir->Down() + 5, 0, 0, BT_UPDATE); text = AddText("For more tutorials, select from Help Menu above", text->Left(), button->Down() + 5); #else text = AddText("For more tutorials, select from Help Menu above", text->Left(), listTutorialDir->Down() + 25); #endif listTutorialDir->SetPos((WIDTH_REMINDER - listTutorialDir->Width())/2, listTutorialDir->getImage()->Y()); listTutorialDir->AddFilter("gedt"); listTutorialDir->setShowDir(false); listTutorialDir->setShowExtension(false); //Help y = DrawHLine(text->Down() + 5); text = AddText("Get help:", 30, y); button = AddButton("Read the documentation", 58, text->Down() + 10, 0, 0, BT_DOCS); button = AddButton("Go to Game Editor's forum", 58, button->Down() + 5, 0, 0, BT_FORUM); //Close y = DrawHLine(button->Down() + 5); button = AddButton("Close", (WIDTH_REMINDER-135)/2 - 30, y, 0, 0, BT_CLOSE); button = AddButton(" Don't show again ", button->Right() + 10, y, 0, 0, BT_DONTSHOW); //Logo { EditorDirectory dir; logo = new Actor("ged_TutorialReminder_logo", this); logo->AddAnimation("logo", "logo.png", 1, 1, 0, 0); logo->SetPos(-logo->Width(), 0); } }
FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) : PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Library Browser" ), wxDefaultPosition, wxDefaultSize, aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ? #ifdef __WINDOWS__ KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP : #else KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT : #endif KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINT_VIEWER_FRAME_NAME ) { wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL ); if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ) SetModal( true ); m_configFrameName = FOOTPRINT_VIEWER_FRAME_NAME; m_showAxis = true; // true to draw axis. // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( modview_icon_xpm ) ); SetIcon( icon ); m_hotkeysDescrList = g_Module_Viewer_Hokeys_Descr; m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL ); m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL ); SetBoard( new BOARD() ); // In viewer, the default net clearance is not known (it depends on the actual board). // So we do not show the default clearance, by setting it to 0 // The footprint or pad specific clearance will be shown GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0); // Ensure all layers and items are visible: GetBoard()->SetVisibleAlls(); SetScreen( new PCB_SCREEN( GetPageSizeIU() ) ); GetScreen()->m_Center = true; // Center coordinate origins on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); // Menu bar is not mandatory: uncomment/comment the next line // to add/remove the menubar ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); ReCreateLibraryList(); UpdateTitle(); PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) ); // Create GAL canvas PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, parentFrame->GetGalCanvas()->GetBackend() ); SetGalCanvas( drawPanel ); // Create the manager and dispatcher & route draw panel events to the dispatcher m_toolManager = new TOOL_MANAGER; m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(), drawPanel->GetViewControls(), this ); m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager ); drawPanel->SetEventDispatcher( m_toolDispatcher ); m_toolManager->RegisterTool( new PCBNEW_CONTROL ); m_toolManager->ResetTools( TOOL_BASE::RUN ); // If a footprint was previously loaded, reload it if( getCurNickname().size() && getCurFootprintName().size() ) { FPID id; id.SetLibNickname( getCurNickname() ); id.SetFootprintName( getCurFootprintName() ); GetBoard()->Add( loadFootprint( id ) ); } drawPanel->DisplayBoard( m_Pcb ); updateView(); m_auimgr.SetManagedWindow( this ); wxSize minsize(100,-1); // Min size of list boxes // Main toolbar is initially docked at the top of the main window and dockable on any side. // The close button is disable because the footprint viewer has no main menu to re-enable it. // The tool bar will only be dockable on the top or bottom of the main frame window. This is // most likely due to the fact that the other windows are not dockable and are preventing the // tool bar from docking on the right and left. wxAuiPaneInfo toolbarPaneInfo; toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false ); EDA_PANEINFO info; info.InfoToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Manage main toolbar, top pane m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo ); // Manage the list of libraries, left pane. m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ) .Left().Row( 1 ).MinSize( minsize ) ); // Manage the list of footprints, center pane. m_auimgr.AddPane( m_footprintList, wxAuiPaneInfo( info ).Name( wxT( "m_footprintList" ) ) .Left().Row( 2 ).MinSize( minsize ) ); // Manage the draw panel, right pane. m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); m_auimgr.AddPane( (wxWindow*) GetGalCanvas(), wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() ); // Manage the message panel, bottom pane. m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() ); if( !m_perspective.IsEmpty() ) { // Restore last saved sizes, pos and other params // However m_mainToolBar size cannot be set to its last saved size // because the actual size change depending on the way modview was called: // the tool to export the current footprint exist or not. // and the saved size is not always OK // the trick is to get the default toolbar size, and set the size after // calling LoadPerspective wxSize tbsize = m_mainToolBar->GetSize(); m_auimgr.LoadPerspective( m_perspective, false ); m_auimgr.GetPane( m_mainToolBar ).BestSize( tbsize ); } // after changing something to the aui manager, // call Update()() to reflect the changes m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) #ifdef USE_WX_GRAPHICS_CONTEXT GetScreen()->SetZoom( BestZoom() ); #else Zoom_Automatique( false ); #endif UseGalCanvas( parentFrame->IsGalCanvasActive() ); if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame { Raise(); // On some window managers, this is needed Show( true ); } } FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME() { if( m_Draw3DFrame ) m_Draw3DFrame->Destroy(); } void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event ) { DBG(printf( "%s:\n", __func__ );) if( IsGalCanvasActive() )
DlgEventKeyDown::DlgEventKeyDown(Actor *actor, bool bUp) : Panel("EventKeyDown", (GameControl::Get()->Width() - ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN))/2, (GameControl::Get()->Height() - ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?HEIGHT:HEIGHT_KEY_DOWN))/2, ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN), ((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?HEIGHT:HEIGHT_KEY_DOWN)) { SetModal(); eventActor = actor; this->bUp = bUp; mode = SDLK_UNKNOWN; Text *text; Button *button; Actor *add; int y; listMode = listRepeat = NULL; textPanel = NULL; //Title text = AddText(bUp?"Key Up Event":"Key Down Event", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); if(bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX)) { //Body text = AddText("Press event key or\nright click for 'any' key: ", 10, y); textKey = AddText(" ", 170, text->Down() - 13); y = textKey->Down() + 5; if(!bUp) { SetToolTip(TIP_DLG_KEYDOWN); text = AddText("Repeat: ", 10, y+2); listRepeat = AddListPop(text->Right(), text->Top(), 128); listRepeat->SetToolTip(TIP_DLG_KEYDOWN_REPEAT); y = listRepeat->Down(); } else { SetToolTip(TIP_DLG_KEYUP); y += 20; } } else { //New Key Down intreface SetToolTip(TIP_DLG_KEYDOWN); text = AddText("Press the key or key sequence (right click for 'any' key)", 10, y); text = AddText("Keys: ", 10, text->Down() + 4); textKey = AddText(" \n " , text->Right(), text->Top() + 2); textPanel = new Panel("textKeyPanel", textKey->Left() - 5, textKey->Top() - 2, textKey->Width() + 5, textKey->Height() + 4, this, true, false, true, false); //Transparent background KrRGBA *pixels = textPanel->getCanvasResource()->Pixels(); if(pixels) { KrRGBA colorBack; colorBack.c.alpha = 0; for(int i = 2; i < textKey->Width() + 3; i++) { for(int j = 2; j < textKey->Height() + 2; j++) { pixels[ j*textPanel->Width() + i ] = colorBack; } } } GetFocus(this); textKey->getImage()->SetZDepth(textPanel->getImage()->ZDepth() + 1000); button = AddButton("Clear", textPanel->Right() - 45, textPanel->Down() + 3, 45, 0, BT_CLEAR); button->SetToolTip(TIP_DLG_KEYDOWN_CLEAR); y = DrawHLine(button->Down() + 3); text = AddText("Execute when: ", 10, y+2); listMode = AddListPop(text->Right(), text->Top(), 230); listMode->SetToolTip(TIP_DLG_KEYDOWN_MODE); text = AddText(" Repeat: ", 10, listMode->Down() + 2); listRepeat = AddListPop(text->Right(), text->Top(), 128); listRepeat->SetToolTip(TIP_DLG_KEYDOWN_REPEAT); listMode->AddText("At least one key is pressed"); listMode->AddText("All keys are pressed"); listMode->AddText("Keys are pressed in order"); listMode->SetItem("At least one key is pressed"); y = listRepeat->Down(); } //Close y = DrawHLine(y + 5); if(Action::inNewActivationEvent()) { add = AddButton("Choose Actor", (((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN)-135)/2 - 15, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE); } else if(Action::getEditAction()) { add = AddButton("Edit Action", (((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN)-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT); } else { add = AddListPop((((bUp || !Tutorial::IsCompatible(VERSION_GET_ANIMINDEX))?WIDTH:WIDTH_KEY_DOWN)-135)/2 - 10, y, 85, 0, LS_ACTION, "Add Action"); ((ListPop *)add)->SetToolTip(TIP_ADDACTION); Action::Populate((ListPop *)add); } if(Action::getEditAction()) { button = AddButton("Cancel", add->Right() + 10, y, 0, 0, BT_CANCEL); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL); } else { button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CANCEL); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE); } if(listRepeat) { listRepeat->AddText("Enable"); listRepeat->AddText("Disable"); listRepeat->SetItem("Enable"); } Clear(); UpdateEdition(); }
GameSettings::GameSettings() : Panel("GameSettings", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - getHeight())/2, WIDTH, getHeight()) { SetModal(); SetToolTip(TIP_GAMESETTINGS); gameSettings = this; listSuspend = listESC = listMotion = NULL; editViewSafeMargin = NULL; gamePort = gameID = NULL; listAutoStartNetwork = listGameServer = NULL; Text *text; Button *button; int y, editSize = 40, editStart = 22; if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { editSize = 45; editStart = 8; } //Title text = AddText("Game Properties", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText("Game resolution: ", 10, y); listRes = AddListPop(text->Right(), text->Top(), 128, 0, LS_RES); listRes->SetToolTip(TIP_GAMESETTINGS_RESOLUTION); editX = AddEditBox(listRes->Right() + editStart, listRes->Top(), editSize); editX->SetNumeric(2, 2000, 1); text = AddText("x", editX->Right()+1, editX->Top()); editY = AddEditBox(text->Right() + 4, text->Top(), editSize); editY->SetNumeric(2, 2000, 1); text = AddText("Mode: ", 10, editY->Down() + 4); listFull = AddListPop(text->Right(), text->Top(), 128, 0, LS_FULL); listFull->SetToolTip(TIP_GAMESETTINGS_MODE); if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { text = AddText(" Safe margin: ", listFull->Right(), listFull->Top()); editViewSafeMargin = AddEditBox(editY->Left(), text->Top(), editSize); editViewSafeMargin->SetNumeric(0, 2000, 1); } text = AddText("Frame rate: ", 10, listFull->Down() + 4); editFps = AddEditBox(text->Right(), text->Top(), 50); editFps->SetNumeric(1, 512, 1); text = AddText("fps", editFps->Right() + 2, editFps->Top()); listMouse = AddListPop(text->Right() + 32, text->Top(), 128, 0, LS_MOUSE); listMouse->SetToolTip(TIP_GAMESETTINGS_MOUSE); if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { text = AddText("Suspend game if lost focus: ", 10, editFps->Down() + 6); listSuspend = AddListPop(text->Right() + 48, text->Top(), 32, 0, LS_SUSPEND); listSuspend->SetToolTip(TIP_GAMESETTINGS_SUSPEND); if(Tutorial::IsCompatible(VERSION_ESC_TO_EXIT)) { text = AddText(" Use ESC key to exit game: ", 10, listSuspend->Down() + 6); listESC = AddListPop(text->Right() + 48, text->Top(), 32, 0, LS_ESC); listESC->SetToolTip(TIP_GAMESETTINGS_ESC); text = AddText(" Motion Compensation: ", 10, listESC->Down() + 6); listMotion = AddListPop(text->Right() + 48, text->Top(), 32, 0, LS_MOTION); listMotion->SetToolTip(TIP_GAMESETTINGS_MOTION_COMPENSATION); } y = DrawHLine(text->Down() + 8); } else { y = DrawHLine(editFps->Down() + 4); } text = AddText("Audio format: ", 10, y); listHz = AddListPop(text->Right(), text->Top(), 128, 0, LS_HZ); listHz->SetToolTip(TIP_GAMESETTINGS_AUDIO_HZ); listStereo = AddListPop(listHz->Right() + 4, listHz->Top(), 128, 0, LS_STEREO); listStereo->SetToolTip(TIP_GAMESETTINGS_AUDIO_STEREO); text = AddText("Maximum number of simultaneous sounds: ", 10, listStereo->Down()+4); editMaxSounds = AddEditBox(text->Right(), text->Top(), 50); editMaxSounds->SetNumeric(1, 512, 1); y = DrawHLine(editMaxSounds->Down() + 2); text = AddText(" Icon file: ", 10, y + 2); iconPath = AddListDirectory(text->Right(), text->Top()); iconPath->SetToolTip(TIP_GAMESETTINGS_ICON); text = AddText(" Game title: ", 10, iconPath->Down() + 4); gameTitle = AddEditBox(text->Right(), text->Top(), 150); text = AddText("Game background color: ", 10, gameTitle->Down() + 4); backgroundColor = new ColorSample(this, text->Right(), text->Top(), 32); backgroundColor->SetToolTip(TIP_GAMESETTINGS_BACKGROUNDCOLOR); //Network if(Tutorial::IsCompatible(VERSION_NETWORK) && GAME_EDITOR_VERSION >= VERSION_NETWORK) { y = DrawHLine(backgroundColor->Down() + 2); text = AddText(" Game ID: ", 10, y); gameID = AddEditBox(text->Right(), text->Top(), 256); text = AddText("Network Port: ", 10, gameID->Down() + 4); gamePort = AddEditBox(text->Right(), text->Top(), 64); text = AddText("Use Game Editor Server: ", 10, gamePort->Down() + 4); listGameServer = AddListPop(text->Right() + 2, text->Top(), 32, 0, LS_GAMESERVER); listGameServer->SetToolTip(TIP_GAMESETTINGS_GAME_SERVER); text = AddText(" Auto Start Network: ", 10, listGameServer->Down() + 4); listAutoStartNetwork = AddListPop(text->Right() + 2, text->Top(), 32, 0, LS_AUTOSTART_NETWORK); listAutoStartNetwork->SetToolTip(TIP_GAMESETTINGS_AUTO_START_NETWORK); y = listAutoStartNetwork->Down() + 2; } else { y = backgroundColor->Down() + 2; } //PocketPC y = DrawHLine(y); listPocketKeys = AddListPop(10, y, 256, 0, LS_POCKET_KEYS, "Pocket PC and GP2X Keys"); listPocketKeys->SetToolTip(TIP_GAMESETTINGS_POCKET_KEYS); //Close y = DrawHLine(listPocketKeys->Down() + 2); button = AddButton("Ok", Width()/2 - 70, y, 0, 0, BT_ADD); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); SetCancelButton(button); //Populate resolutions char buf[64]; if(Tutorial::IsOff()) { SDL_Rect **modes; const SDL_VideoInfo *vinfo = SDL_GetVideoInfo(); /* Get available fullscreen/hardware modes */ modes=SDL_ListModes(vinfo->vfmt, VIDEO_FLAGS | SDL_FULLSCREEN); if(modes != (SDL_Rect **)0 && modes != (SDL_Rect **)-1) { for(int i=0;modes[i];++i) { sprintf(buf, "%d x %d", modes[i]->w, modes[i]->h); listRes->AddText(buf); } } } else { //Don't change in different machines listRes->AddText("1280 x 1024"); listRes->AddText("1280 x 960"); listRes->AddText("1280 x 768"); listRes->AddText("1280 x 720"); listRes->AddText("1152 x 864"); listRes->AddText("1024 x 768"); listRes->AddText("848 x 480"); listRes->AddText("800 x 600"); listRes->AddText("720 x 576"); listRes->AddText("720 x 480"); listRes->AddText("640 x 480"); listRes->AddText("640 x 400"); listRes->AddText("512 x 384"); listRes->AddText("480 x 360"); listRes->AddText("400 x 300"); listRes->AddText("320 x 240"); listRes->AddText("320 x 200"); } if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { listRes->AddText("240 x 320"); listRes->AddText("240 x 320 Pocket PC"); listRes->AddText("240 x 320 Pocket PC Upside down"); listRes->AddText("320 x 240 Pocket PC Rotate left"); listRes->AddText("320 x 240 Pocket PC Rotate right"); listRes->AddText("480 x 640 Pocket PC"); listRes->AddText("480 x 640 Pocket PC Upside down"); listRes->AddText("640 x 480 Pocket PC Rotate left"); listRes->AddText("640 x 480 Pocket PC Rotate right"); listRes->AddText("800 x 480 Pocket PC Rotate left"); listRes->AddText("800 x 480 Pocket PC Rotate right"); //No changes in screen orientation now (don't have the w > h information) listRes->AddText("240 x 240 Pocket PC"); listRes->AddText("480 x 480 Pocket PC"); //Smartphone listRes->AddText("176 x 220 Smartphone"); listRes->AddText("160 x 240 Smartphone"); listRes->AddText("208 x 240 Smartphone"); listRes->AddText("240 x 320 Smartphone"); //HPC listRes->AddText("640 x 240 Handheld PC"); listRes->AddText("640 x 480 Handheld PC"); listRes->AddText("800 x 480 Handheld PC"); listRes->AddText("800 x 600 Handheld PC"); //GP2X listRes->AddText("320 x 240 GP2X"); listRes->AddText("640 x 480 GP2X"); // Apple iPhone // AKR listRes->AddText("320 x 480 iPhone"); listRes->AddText("480 x 320 iPhone Rotate left"); // Apple iPad // AKR listRes->AddText("768 x 1024 iPad"); listRes->AddText("1024 x 768 iPad Rotate left"); } else { listRes->AddText("240 x 320 Pocket PC"); } listFull->AddText("Full screen"); listFull->AddText("Window"); listHz->AddText("44100 Hz"); listHz->AddText("22050 Hz"); listHz->AddText("11025 Hz"); listStereo->AddText("Stereo"); listStereo->AddText("Mono"); listMouse->AddText("Show mouse"); listMouse->AddText("Hide mouse"); if(listSuspend) { listSuspend->AddText("Yes"); listSuspend->AddText("No"); if(GameControl::Get()->getSuspendGameIfLostFocus()) listSuspend->SetItem("Yes"); else listSuspend->SetItem("No"); } if(listAutoStartNetwork) { listAutoStartNetwork->AddText("Yes"); listAutoStartNetwork->AddText("No"); if(GameControl::Get()->getAutoStartNetwork()) listAutoStartNetwork->SetItem("Yes"); else listAutoStartNetwork->SetItem("No"); } if(listGameServer) { listGameServer->AddText("Yes"); listGameServer->AddText("No"); if(GameControl::Get()->getUseGameEditorServer()) listGameServer->SetItem("Yes"); else listGameServer->SetItem("No"); } if(listESC) { listESC->AddText("Yes"); listESC->AddText("No"); if(GameControl::Get()->getUseESCKeyToExit()) listESC->SetItem("Yes"); else listESC->SetItem("No"); } if(listMotion) { listMotion->AddText("Yes"); listMotion->AddText("No"); if(GameControl::Get()->getUseMotionCorrection()) listMotion->SetItem("Yes"); else listMotion->SetItem("No"); } if(gameID) { gameID->SetText(GameControl::Get()->getGameID()); } if(gamePort) { gamePort->SetText(GameControl::Get()->getGamePort()); } if(GameControl::Get()->getFullScreen()) listFull->SetItem("Full screen"); else listFull->SetItem("Window"); if(GameControl::Get()->getStereo()) listStereo->SetItem("Stereo"); else listStereo->SetItem("Mono"); if(GameControl::Get()->getShowMouse()) listMouse->SetItem("Show mouse"); else listMouse->SetItem("Hide mouse"); if(editViewSafeMargin) { editViewSafeMargin->SetText((int)GameControl::Get()->getViewSafeMargin()); } sprintf(buf, "%ld Hz", GameControl::Get()->getAudioSamplerRate()); listHz->SetItem(buf); sprintf(buf, "%d x %d", GameControl::Get()->getGameWidth(), GameControl::Get()->getGameHeight()); listRes->SetItem(buf); editX->SetText(GameControl::Get()->getGameWidth()); editY->SetText(GameControl::Get()->getGameHeight()); editFps->SetText(GameControl::Get()->getFrameRate()); editMaxSounds->SetText(GameControl::Get()->getMaximumSounds()); bFlipPocketPCScreen = GameControl::Get()->getFlipPocketPCScreen(); gedString res(buf); if(res == "240 x 320") { if(bFlipPocketPCScreen) { listRes->SetText("240 x 320 Up. down"); } } else if(res == "320 x 240") { if(bFlipPocketPCScreen) { listRes->SetText("320 x 240 Rot.right"); } else { listRes->SetText("320 x 240 Rot. left"); } } else if(res == "480 x 640") { if(bFlipPocketPCScreen) { listRes->SetText("480 x 640 Up. down"); } else { listRes->SetText("480 x 640 Pocket PC"); } } else if(res == "640 x 480") { if(bFlipPocketPCScreen) { listRes->SetText("640 x 480 Rot.right"); } else { //listRes->SetText("640 x 480 Rot. left"); listRes->SetText("640 x 480"); } } else if(res == "320 x 480") { listRes->SetText("320 x 480 iPhone"); } else if(res == "480 x 320") { listRes->SetText("480 x 320 Rot.left"); } else if(res == "768 x 1024") { listRes->SetText("768x1024 iPad"); } else if(res == "800 x 480") { if(bFlipPocketPCScreen) { listRes->SetText("800 x 480 Rot.right"); } else { listRes->SetText("800 x 480"); } } else if(res == "240 x 240") { listRes->SetText("240 x 240 Pocket PC"); } else if(res == "480 x 480") { listRes->SetText("480 x 480 Pocket PC"); } else if(res == "176 x 220") { listRes->SetText("176 x 220 Smartphone"); } else if(res == "160 x 240") { listRes->SetText("160 x 240 Smartphone"); } else if(res == "208 x 240") { listRes->SetText("208 x 240 Smartphone"); } iconPath->AddFilter("tga"); iconPath->AddFilter("bmp"); iconPath->AddFilter("pnm"); iconPath->AddFilter("xpm"); iconPath->AddFilter("xcf"); iconPath->AddFilter("pcx"); iconPath->AddFilter("gif"); iconPath->AddFilter("jpg"); iconPath->AddFilter("jpeg"); iconPath->AddFilter("jpe"); iconPath->AddFilter("jfif"); iconPath->AddFilter("tif"); iconPath->AddFilter("tiff"); iconPath->AddFilter("iff"); iconPath->AddFilter("lbm"); iconPath->AddFilter("png"); iconPath->AddFilter("ico"); //iconPath->SetText(GameControl::Get()->getIconPath()); if(!GameControl::Get()->getIconPath().empty()) { gedString file, dir; SplitPath(GameControl::Get()->getIconPath(), file, dir); chdir(dir.c_str()); iconPath->AddText(file); iconPath->SetItem(file); } gameTitle->SetText(GameControl::Get()->getGameTitle()); backgroundColor->setColor(GameControl::Get()->getBackGroundColor()); SetPocketKeys(); }
ChangeParent::ChangeParent(Actor *actor, bool bOnCollision) : BaseAction("Change Parent", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - HEIGHT)/2, WIDTH, HEIGHT) { SetModal(); SetToolTip(TIP_CHANGEPARENT); this->eventActor = actionActor = actor; Text *text; Button *button; int y; //Title text = AddText(CHANGE_PARENT, CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body text = AddText(" Child: ", 10, y); listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(gedString(TIP_CHANGEPARENT_CHILD) + TIP_ACTION_ACTOR); text = AddText(" Parent: ", 10, listActor->Down()); listParent = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_PARENT); listParent->SetToolTip(TIP_CHANGEPARENT_PARENT); //Close y = DrawHLine(listParent->Down() + 2); button = AddButton(Action::getEditAction()?"Ok":"Add", 45, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD); SetConfirmButton(button); button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); SetCancelButton(button); GameControl::Get()->PopulateActors(listParent); listParent->AddText(NO_PARENT); if(actionActor && actionActor->getParent()) { listParent->SetItem(actionActor->getCloneName()); } else { listParent->SetItem(NO_PARENT); } GameControl::Get()->PopulateActors(listActor); listActor->AddText(S_EVENT_ACTOR); listParent->AddText(S_EVENT_ACTOR); if(Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { listActor->AddText(S_PARENT_ACTOR); listActor->AddText(S_CREATOR_ACTOR); listParent->AddText(S_PARENT_ACTOR); listParent->AddText(S_CREATOR_ACTOR); } if(bOnCollision) listParent->AddText(S_COLLIDE_ACTOR); if(bOnCollision) listActor->AddText(S_COLLIDE_ACTOR); listActor->SetItem(S_EVENT_ACTOR); if(!ExpressionEditor::getExpressionEditor()) UpdateEdition(); }
CTDuelInvite::CTDuelInvite(){ SetDialogType(DLG_TYPE_DUELINVITE); SetModal(); }
DlgCollision::DlgCollision(Actor *actor, bool bCollision) : Panel("DlgCollision", (GameControl::Get()->Width() - WIDTH)/2, (GameControl::Get()->Height() - (bCollision?(HEIGHT + 55):HEIGHT))/2, WIDTH, bCollision?(HEIGHT + 55):HEIGHT) { SetModal(); eventActor = actionActor = actor; this->bCollision = bCollision; Text *text; Button *button; Actor *add; int y; //Title text = AddText(bCollision?"Collision Event":"Collision Finish Event", CENTER_TEXT, 5); y = DrawHLine(text->Down() + 2); //Body if(bCollision) { SetToolTip(TIP_DLG_COLLISION); text = AddText(" On: ", 10, y); listSide = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_SIDE); listSide->SetToolTip(TIP_DLG_COLLISION_SIDE); text = AddText(" Of Actor: ", 10, listSide->Down() + 2); listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_DLG_COLLISION_ACTOR); text = AddText(" Repeat this event\nwhile actor is colliding: ", 10, listActor->Down() + 2); listType = AddListPop(listActor->Right() - 40, text->Top() + 10, 40, 0, LS_TYPE); listType->SetToolTip(TIP_DLG_COLLISION_REPEAT); listType->AddText("Yes"); listType->AddText("No"); listType->SetItem("No"); listSide->AddText("Any Side"); listSide->AddText("Top Side"); listSide->AddText("Bottom Side"); listSide->AddText("Left Side"); listSide->AddText("Right Side"); listSide->AddText("Top or Bottom Side"); listSide->AddText("Left or Right Side"); listSide->SetItem("Any Side"); side = ANY_SIDE; y = listType->Down() + 2; } else { SetToolTip(TIP_DLG_COLLISION_FINISH); text = AddText(" Actor: ", 10, y); listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_DLG_COLLISION_ACTOR); y = listActor->Down() + 2; } //Close y = DrawHLine(y); if(Action::inNewActivationEvent()) { add = AddButton("Choose Actor", 25, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE); } else if(Action::getEditAction()) { add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT); } else { add = AddListPop(30, y, 85, 0, LS_ACTION, "Add Action"); ((ListPop *)add)->SetToolTip(TIP_ADDACTION); Action::Populate((ListPop *)add); } if(Action::getEditAction()) { button = AddButton("Cancel", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL); } else { button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE); } GameControl::Get()->PopulateActors(listActor); if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION)) { //Set default only in old tutorials listActor->SetItem(actionActor->getCloneIndex()?actionActor->getCloneName():actionActor->getActorName()); } listActor->AddText(ANY_ACTOR); listActor->RemoveText(VIEW_NAME); UpdateEdition(); }
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) : PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ), wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT, FOOTPRINT_WIZARD_FRAME_NAME ) { wxASSERT( aFrameType==FRAME_PCB_FOOTPRINT_WIZARD_MODAL ); if( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD_MODAL ) SetModal( true ); wxAcceleratorTable table( ACCEL_TABLE_CNT, accels ); m_FrameName = FOOTPRINT_WIZARD_FRAME_NAME; m_configPath = wxT( "FootprintWizard" ); m_showAxis = true; // true to draw axis. // Give an icon wxIcon icon; icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) ); SetIcon( icon ); m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr; m_wizardName.Empty(); SetBoard( new BOARD() ); // Ensure all layers and items are visible: GetBoard()->SetVisibleAlls(); SetScreen( new PCB_SCREEN( GetPageSizeIU() ) ); GetScreen()->m_Center = true; // Center coordinate origins on screen. LoadSettings( config() ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); ReCreateHToolbar(); ReCreateVToolbar(); // Creates the parameter pages list m_pageList = new wxListBox( this, ID_FOOTPRINT_WIZARD_PAGE_LIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL ); // Creates the The list of parameters for the current parameter page m_parameterGrid = new wxGrid( this, ID_FOOTPRINT_WIZARD_PARAMETER_LIST ); m_parameterGrid->CreateGrid( 1, 3 ); // Columns m_parameterGrid->SetColLabelValue( 0, _( "Parameter" ) ); m_parameterGrid->SetColLabelValue( 1, _( "Value" ) ); m_parameterGrid->SetColLabelValue( 2, _( "Units" ) ); m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); m_parameterGrid->AutoSizeColumns(); ReCreatePageList(); DisplayWizardInfos(); if( m_canvas ) m_canvas->SetAcceleratorTable( table ); m_auimgr.SetManagedWindow( this ); EDA_PANEINFO horiztb; horiztb.HorizontalToolbarPane(); EDA_PANEINFO info; info.InfoToolbarPane(); EDA_PANEINFO mesg; mesg.MessageToolbarPane(); // Manage main toolbal m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ). Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) ); // Manage the left window (list of parameter pages) EDA_PANEINFO paneList; paneList.InfoToolbarPane().Name( wxT( "m_pageList" ) ).Left().Row( 0 ); m_auimgr.AddPane( m_pageList, wxAuiPaneInfo( paneList ) ); // Manage the parameters grid editor for the current parameter page EDA_PANEINFO panePrms; panePrms.InfoToolbarPane().Name( wxT( "m_parameterGrid" ) ).Left().Row( 1 ); m_auimgr.AddPane( m_parameterGrid, wxAuiPaneInfo( panePrms ) ); // Manage the draw panel m_auimgr.AddPane( m_canvas, wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); // Manage the message panel m_auimgr.AddPane( m_messagePanel, wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(1) ); // Gives a min size and the last saved size to left windows m_auimgr.GetPane( m_pageList ).MinSize( wxSize(60, -1 ) ); m_auimgr.GetPane( m_pageList ).BestSize( wxSize(m_pageListWidth, -1) ); m_auimgr.GetPane( m_parameterGrid ).MinSize( wxSize( 120, -1 ) ); m_auimgr.GetPane( m_parameterGrid ).BestSize( wxSize(m_parameterGridWidth, -1) ); m_auimgr.Update(); // Now Drawpanel is sized, we can use BestZoom to show the component (if any) #ifdef USE_WX_GRAPHICS_CONTEXT GetScreen()->SetZoom( BestZoom() ); #else Zoom_Automatique( false ); #endif Show( true ); this->SelectFootprintWizard(); }