Esempio n. 1
0
wxSize wxGauge::DoGetBestSize() const
{
    // Windows HIG (http://msdn.microsoft.com/en-us/library/aa511279.aspx)
    // suggest progress bar size of "107 or 237 x 8 dialog units". Let's use
    // the smaller one.

    if (HasFlag(wxGA_VERTICAL))
        return ConvertDialogToPixels(wxSize(8, 107));
    else
        return ConvertDialogToPixels(wxSize(107, 8));
}
dlgPackage::dlgPackage(pgaFactory *f, frmMain *frame, edbPackage *node, pgSchema *sch)
: dlgSecurityProperty(f, frame, node, wxT("dlgPackage"), wxT("EXECUTE"), "X")
{
    schema=sch;
    package=node;

    txtHeader->SetMarginType(1, wxSTC_MARGIN_NUMBER);
    txtHeader->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);

    txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
    txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
}
Esempio n. 3
0
dlgFunction::dlgFunction(pgaFactory *f, frmMain *frame, pgFunction *node, pgSchema *sch)
	: dlgSecurityProperty(f, frame, node, wxT("dlgFunction"), wxT("EXECUTE"), "X"),
	  isEdbWrapped( false )
{
	schema = sch;
	function = node;
	isProcedure = false;

	seclabelPage = new ctlSeclabelPanel(nbNotebook);

	txtArguments->Disable();

	bool bVal;
	settings->Read(wxT("frmQuery/ShowLineNumber"), &bVal, false);
	if (!bVal)
	{
		txtSqlBox->SetMarginType(1, wxSTC_MARGIN_NUMBER);
		txtSqlBox->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
	}

	btnAdd->Disable();
	btnRemove->Disable();
	btnChange->Disable();

	lstVariables->CreateColumns(0, _("Variable"), _("Value"), -1);
	chkValue->Hide();
}
Esempio n. 4
0
void pgDialog::PostCreation()
{
	if (!statusBar && FindWindow(STATUSBAR_CONTAINER))
		AddStatusBar();

	if (GetWindowStyle() & wxRESIZE_BORDER)   // is designed with sizers; don't change
		return;

	if (!btnCancel)
		return;

	wxSize  size = btnCancel->GetSize();
	wxPoint pos = btnCancel->GetPosition();
	int height = pos.y + size.GetHeight() + ConvertDialogToPixels(wxSize(0, 3)).y;
	if (statusBar)
		height += statusBar->GetSize().GetHeight();

	int right = pos.x + ConvertDialogToPixels(wxSize(50, 0)).x - size.GetWidth();
	btnCancel->Move(right, pos.y);

	if (btnOK)
	{
		size = btnOK->GetSize();
		right -= size.GetWidth() + ConvertDialogToPixels(wxSize(3, 0)).x;
		btnOK->Move(right, pos.y);
	}

// On OS X, reverse the buttons for UI consistency
#ifdef __WXMAC__
	wxPoint pos2;
	pos = btnCancel->GetPosition();

	if (btnOK)
	{
		pos2 = btnOK->GetPosition();
		btnOK->Move(pos.x, pos.y);
	}

	btnCancel->Move(pos2.x, pos2.y);
#endif

	int w, h;
	size = GetSize();
	GetClientSize(&w, &h);

	SetSize(size.GetWidth(), size.GetHeight() + height - h);
}
Esempio n. 5
0
dlgPackage::dlgPackage(pgaFactory *f, frmMain *frame, edbPackage *node, pgSchema *sch)
	: dlgSecurityProperty(f, frame, node, wxT("dlgPackage"), wxT("EXECUTE"), "X")
{
	schema = sch;
	package = node;

	bool bVal;
	settings->Read(wxT("frmQuery/ShowLineNumber"), &bVal, false);
	if (!bVal)
	{
		txtHeader->SetMarginType(1, wxSTC_MARGIN_NUMBER);
		txtHeader->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);

		txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
		txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
	}
}
Esempio n. 6
0
void wxStaticBox::DoGetClientSize(int *width, int *height) const
{
    // See: http://msdn.microsoft.com/en-us/library/aa511279.aspx
    wxPoint lr = ConvertDialogToPixels(wxPoint(6,7));
    wxPoint ul = GetClientAreaOrigin();
    wxSize  sz = GetSize();
    
    if (width)
        *width = sz.x - ul.x - lr.x;
    if (height)
        *height = sz.y - ul.y - lr.x;
}
Esempio n. 7
0
CaptureWin::CaptureWin()
:	wxDialog(NULL, -1, wxString(_T(APPNAME) _T(" - profiling")),
			 wxDefaultPosition, wxDefaultSize,
			 wxDEFAULT_DIALOG_STYLE)
{
	cancelled = stopped = paused = false;
	win7taskBar = NULL;

	wxBoxSizer *rootsizer = new wxBoxSizer(wxVERTICAL);
	wxBoxSizer *panelsizer = new wxBoxSizer(wxVERTICAL);

	rootsizer->SetMinSize(400, 0);

	wxPanel *panel = new wxPanel(this);

	progressText = new wxStaticText( panel, -1, "Waiting..." );
	progressBar = new wxGauge( panel, -1, 0, wxDefaultPosition, wxSize(100,18) );
	progressBar->SetRange(MAX_RANGE);

	wxBitmap pause = LoadPngResource(L"button_pause");
	pauseButton = new wxBitmapToggleButton(
		panel, CaptureWin_Pause, pause, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|wxBU_EXACTFIT );

	wxButton *okButton = new wxButton(panel, wxID_OK, "&Stop");
	okButton->SetToolTip("Stop profiling and display collected results.");
	wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "&Abort");
	cancelButton->SetToolTip("Stop profiling, discard collected results, and exit.");

	int border = ConvertDialogToPixels(wxSize(2, 0)).x;
	wxSizer *buttons = new wxBoxSizer(wxHORIZONTAL);
	buttons->Add(pauseButton,				0, wxALIGN_LEFT,					border);
	buttons->AddStretchSpacer();
	buttons->Add(okButton,					0, wxALIGN_RIGHT | wxLEFT|wxRIGHT,	border);
	buttons->Add(cancelButton,				0, wxALIGN_RIGHT | wxLEFT,			border);

	panelsizer->Add(progressText, 0, wxBOTTOM, 3);
	panelsizer->Add(progressBar, 0, wxBOTTOM|wxEXPAND, 10);
	panelsizer->Add(buttons, 0, wxEXPAND);

	okButton->SetDefault();

	panel->SetSizer(panelsizer);
	panel->SetAutoLayout(TRUE);

	rootsizer->Add(panel, 1, wxEXPAND | wxALL, 10);
	SetSizer(rootsizer);
	rootsizer->SetSizeHints(this);
	SetAutoLayout(TRUE);

	Centre();
}
dlgSelectConnection::dlgSelectConnection(wxWindow *parent, frmMain *form) : 
DialogWithHelp(form)
{
 	remoteServer = NULL;

    wxWindowBase::SetFont(settings->GetSystemFont());
    LoadResource(parent, wxT("dlgSelectConnection"));

    SetIcon(wxIcon(connect_xpm));
    RestorePosition();

	cbServer = new ctlComboBoxFix(this, CTRLID_CBSERVER, ConvertDialogToPixels(wxPoint(65,5)), ConvertDialogToPixels(wxSize(135,12)), wxCB_DROPDOWN | wxCB_READONLY);
	cbDatabase = new wxComboBox(this, CTRLID_CBDATABASE, wxEmptyString, ConvertDialogToPixels(wxPoint(65,20)), ConvertDialogToPixels(wxSize(135,12)), NULL, wxCB_DROPDOWN | wxCB_READONLY);

	if (form == NULL)
	{
		cbServer->SetValue(settings->Read(wxT("QuickConnect/server"), wxEmptyString));
		cbDatabase->SetValue(settings->Read(wxT("QuickConnect/database"), wxEmptyString));
		cbUsername->SetValue(settings->Read(wxT("QuickConnect/username"), wxEmptyString));
	}

	btnOK->Enable(cbServer->GetValue().Length() > 0 && cbDatabase->GetValue().Length() > 0 && cbUsername->GetValue().Length() > 0);
}
Esempio n. 9
0
dlgTrigger::dlgTrigger(pgaFactory *f, frmMain *frame, pgTrigger *node, pgTable *parentNode)
	: dlgCollistProperty(f, frame, wxT("dlgTrigger"), parentNode)
{
	trigger = node;
	table = parentNode;
	wxASSERT(!table || table->GetMetaType() == PGM_TABLE || table->GetMetaType() == PGM_VIEW
	         || table->GetMetaType() == GP_PARTITION);

	bool bVal;
	settings->Read(wxT("frmQuery/ShowLineNumber"), &bVal, false);
	if (!bVal)
	{
		txtBody->SetMarginType(1, wxSTC_MARGIN_NUMBER);
		txtBody->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x);
	}

	lstColumns->AddColumn(_("Column name"));
}
Esempio n. 10
0
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
    SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
        wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
{
    m_showAxis   = true;            // true to draw axis
    SetShowDeMorgan( false );
    m_DrawSpecificConvert = true;
    m_DrawSpecificUnit    = false;
    m_hotkeysDescrList    = g_Libedit_Hotkeys_Descr;
    m_SyncPinEdit         = false;
    m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
    SetShowElectricalType( true );
    m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) );    // default in case of no prefs

    m_my_part = NULL;
    m_treePane = nullptr;
    m_libMgr = nullptr;
    m_unit = 1;
    m_convert = 1;
    m_AboutTitle = "LibEdit";

    // Delayed initialization
    if( g_LastTextSize == -1 )
        g_LastTextSize = GetDefaultTextSize();

    // Initialize grid id to the default value 50 mils:
    m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;

    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_libedit_xpm ) );
    SetIcon( icon );

    LoadSettings( config() );

    // Ensure axis are always drawn
    KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
    gal_opts.m_axesEnabled = true;

    m_dummyScreen = new SCH_SCREEN( aKiway );
    SetScreen( m_dummyScreen );
    GetScreen()->m_Center = true;
    GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );

    SetCrossHairPosition( wxPoint( 0, 0 ) );

    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    m_libMgr = new LIB_MANAGER( *this );
    SyncLibraries( true );
    m_treePane = new SYMBOL_TREE_PANE( this, m_libMgr );

    setupTools();
    ReCreateMenuBar();
    ReCreateHToolbar();
    ReCreateVToolbar();
    ReCreateOptToolbar();

    updateTitle();
    DisplayCmpDoc();
    RebuildSymbolUnitsList();

    m_auimgr.SetManagedWindow( this );
    m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );

    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_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
    m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1)
                      .Caption( _( "Libraries" ) ).MinSize( 250, -1 )
                      .BestSize( m_defaultLibWidth, -1 ).Resizable() );
    m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );

    m_auimgr.AddPane( m_canvas->GetWindow(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );

    m_auimgr.Update();

    GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );

    Raise();
    Show( true );

    Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnConfigurePaths, this,
          ID_PREFERENCES_CONFIGURE_PATHS );

    Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
          ID_EDIT_SYM_LIB_TABLE );

    m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );

    SyncView();
    GetGalCanvas()->GetViewControls()->SetSnapping( true );
    GetGalCanvas()->GetView()->UseDrawPriority( true );
    GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
    GetGalCanvas()->GetGAL()->SetAxesEnabled( true );

    // Set the working/draw area size to display a symbol to a reasonable value:
    // A 600mm x 600mm with a origin at the area center looks like a large working area
    double max_size_x = Millimeter2iu( 600 );
    double max_size_y = Millimeter2iu( 600 );
    BOX2D bbox;
    bbox.SetOrigin( -max_size_x /2, -max_size_y/2 );
    bbox.SetSize( max_size_x, max_size_y );
    GetCanvas()->GetView()->SetBoundary( bbox );
}
Esempio n. 11
0
wxPoint wxStaticBox::GetClientAreaOrigin() const
{
    // See: http://msdn.microsoft.com/en-us/library/aa511279.aspx
    wxPoint pt = ConvertDialogToPixels(wxPoint(6,11));
    return pt;
}
Esempio n. 12
0
dlgEditGridOptions::dlgEditGridOptions(frmEditGrid *win, pgConn *conn, const wxString &rel, ctlSQLEditGrid *grid)
{
    editGrid = grid;
    connection = conn;
    relation = rel;
    parent = win;
    wxWindowBase::SetFont(settings->GetSystemFont());
    LoadResource(win, wxT("dlgEditGridOptions"));
    conv = conn->GetConv();

    // Icon
    SetIcon(*sortfilter_png_ico);
    RestorePosition();

    int cols = grid->GetNumberCols();
    long x;

    for (x = 0; x < cols; x++)
        cboColumns->Append(grid->GetColLabelValue(x).BeforeFirst('\n'));

    // Setup the buttons
    wxCommandEvent nullEvent;
    OnCboColumnsChange(nullEvent);
    wxListEvent nullLstEvent;
    OnLstSortColsChange(nullLstEvent);

    // Setup the list box
    int leftSize = 140, rightSize;
    leftSize = ConvertDialogToPixels(wxPoint(leftSize, 0)).x;
    rightSize = lstSortCols->GetClientSize().GetWidth() - leftSize;
    // This check is to work around a bug in wxGTK that doesn't set
    // appropriately the GetClientSize().
    // Without this workaround, we have an invisible second column.
    if (rightSize < leftSize)
        rightSize = leftSize + 1;
    lstSortCols->InsertColumn(0, _("Column name"), wxLIST_FORMAT_LEFT, leftSize);
    lstSortCols->InsertColumn(1, _("Sort order"), wxLIST_FORMAT_LEFT, rightSize);

    // Setup the filter SQL box. This is an XRC 'unknown' control so must
    // be manually created and attache to the XRC global resource.
    filter->SetText(parent->GetFilter());

    // Get the current sort columns, and populate the listbox.
    // The current columns will be parsed char by char to allow us
    // to cope with quoted column names with commas in them (let's hope
    // noone ever does that, but sod's law etc....)
    bool inColumn = true, inQuote = false;
    wxString sortCols = parent->GetSortCols();
    wxString col, dir;
    size_t pos, len = sortCols.Length();
    int itm = 0;

    for (pos = 0; pos < len; pos++)
    {
        if (inColumn)
        {
            if (sortCols.GetChar(pos) == '"') inQuote = !inQuote;
            if (!inQuote && (sortCols.GetChar(pos) == ' ' || sortCols.GetChar(pos) == ','))
                inColumn = false;
            else if (sortCols.GetChar(pos) != '"') col += sortCols.GetChar(pos);
        }
        else
        {
            if (sortCols.GetChar(pos - 1) == ',')
            {
                inColumn = true;
                lstSortCols->InsertItem(itm, col);
                if (dir.GetChar(0) == 'D')
                {
                    lstSortCols->SetItem(itm, 1, _("Descending"));
                    lstSortCols->SetItemData(itm, 0);
                }
                else
                {
                    lstSortCols->SetItem(itm, 1, _("Ascending"));
                    lstSortCols->SetItemData(itm, 1);
                }
                col = wxT("");
                dir = wxT("");
                ++itm;
            }
            else
            {
                dir += sortCols.GetChar(pos);
            }
        }
    }

    // Insert the last column
    if (col.Length() > 0)
    {
        lstSortCols->InsertItem(itm, col);
        if (dir.GetChar(0) == 'D')
        {
            lstSortCols->SetItem(itm, 1, _("Descending"));
            lstSortCols->SetItemData(itm, 0);
        }
        else
        {
            lstSortCols->SetItem(itm, 1, _("Ascending"));
            lstSortCols->SetItemData(itm, 1);
        }
    }

    // Finally (phew!) remove all columns we're already sorting on from the list.
    long count = lstSortCols->GetItemCount();

    for (x = 0; x < count; x++)
    {
        int idx = cboColumns->FindString(lstSortCols->GetItemText(x));
        if (idx >= 0)
            cboColumns->Delete(idx);
    }

    // Display the appropriate tab. If the EditGrid is not shown, we must be
    // doing a View Filtered Data.
    if (!parent->IsShown())
        nbOptions->DeletePage(0);

    btnValidate->Disable();
    filter->SetFocus();
}
FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
                                            EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) :
    PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
                         wxDefaultPosition, wxDefaultSize,
                         KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
{
    m_showBorderAndTitleBlock = false;   // true to show the frame references
    m_showAxis = true;                   // true to show X and Y axis on screen
    m_showGridAxis = true;               // show the grid origin axis
    m_hotkeysDescrList = g_Module_Editor_Hotkeys_Descr;
    m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) );    // default in case of no prefs
    m_canvasType = aBackend;
    m_AboutTitle = "ModEdit";

    // Give an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
    SetIcon( icon );

    // Create GAL canvas
    if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN )
        m_canvasType = LoadCanvasTypeSetting();
    else
        m_canvasType = aBackend;

    PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
                                                            GetGalDisplayOptions(), m_canvasType );
    SetGalCanvas( drawPanel );

    SetBoard( new BOARD() );
    // In modedit, 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 );

    // Don't show the default board solder mask clearance in the footprint editor.  Only the
    // footprint or pad clearance setting should be shown if it is not 0.
    GetBoard()->GetDesignSettings().m_SolderMaskMargin = 0;

    // restore the last footprint from the project, if any
    restoreLastFootprint();

    // Ensure all layers and items are visible:
    // In footprint editor, some layers have no meaning or
    // cannot be used, but we show all of them, at least to be able
    // to edit a bad layer
    GetBoard()->SetVisibleAlls();

    // However the "no net" mark on pads is useless, because there is
    // no net in footprint editor: make it non visible
    GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );

    m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true );

    // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
    // initialize parameters in m_LayersManager
    LoadSettings( config() );
    GetGalDisplayOptions().m_axesEnabled = true;

    SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
    GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );

    GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
    GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );

    // In modedit, set the default paper size to A4:
    // this should be OK for all footprint to plot/print
    SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );

    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    initLibraryTree();
    m_treePane = new FOOTPRINT_TREE_PANE( this );

    // Create the manager and dispatcher & route draw panel events to the dispatcher
    setupTools();

    // ReCreateMenuBar();       // UseGalCanvas() will do this for us.
    ReCreateHToolbar();
    ReCreateVToolbar();
    ReCreateOptToolbar();

    m_Layers->ReFill();
    m_Layers->ReFillRender();

    GetScreen()->m_Active_Layer = F_SilkS;
    m_Layers->SelectLayer( F_SilkS );
    m_Layers->OnLayerSelected();

    m_auimgr.SetManagedWindow( this );
    m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );

    // Horizontal items; layers 4 - 6
    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) );

    // Vertical items; layers 1 - 3
    m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
    m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1)
                      .Caption( _( "Libraries" ) ).MinSize( 250, 400 )
                      .BestSize( m_defaultLibWidth, -1 ) );

    m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
    m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
                      .Caption( _( "Layers Manager" ) ).PaneBorder( false )
                      .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );

    m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
    m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );

    GetGalCanvas()->GetGAL()->SetAxesEnabled( true );

    // Set up viewport
    KIGFX::VIEW* view = GetGalCanvas()->GetView();
    view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
    view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );

    UseGalCanvas();

    m_auimgr.Update();
    updateTitle();

    Raise();            // On some window managers, this is needed
    Show( true );

    Zoom_Automatique( false );
}
Esempio n. 14
0
bool CToolBar::Realize()
{
	wxASSERT(HasFlag(wxTB_NOICONS));

	bool ret = wxToolBar::Realize();
	if (!ret) {
		return false;
	}

	wxSize const size = GetToolBitmapSize();
	wxASSERT(size.x > 0 && size.y > 0);
	auto toolImages = std::make_unique<wxImageList>(size.x, size.y, false, 0);
	auto disabledToolImages = std::make_unique<wxImageList>(size.x, size.y, false, 0);

	HWND hwnd = GetHandle();

	auto hImgList = reinterpret_cast<HIMAGELIST>(toolImages->GetHIMAGELIST());
	auto hDisabledImgList = reinterpret_cast<HIMAGELIST>(disabledToolImages->GetHIMAGELIST());
	::SendMessage(hwnd, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(hImgList));
	::SendMessage(hwnd, TB_SETDISABLEDIMAGELIST, 0, reinterpret_cast<LPARAM>(hDisabledImgList));

	toolImages_ = std::move(toolImages);
	disabledToolImages_ = std::move(disabledToolImages);

	for (size_t i = 0; i < GetToolsCount(); ++i) {
		auto tool = GetToolByPos(static_cast<int>(i));
		if (!tool || tool->GetStyle() != wxTOOL_STYLE_BUTTON) {
			continue;
		}

		auto bmp = tool->GetBitmap();
		if (!bmp.IsOk()) {
			continue;
		}
			
		int image = toolImages_->Add(bmp);
		auto disabled = tool->GetDisabledBitmap();
		if (!disabled.IsOk()) {
			disabled = wxBitmap(bmp.ConvertToImage().ConvertToGreyscale());
		}
		disabledToolImages_->Add(disabled);

		TBBUTTONINFO btn{};
		btn.cbSize = sizeof(TBBUTTONINFO);
		btn.dwMask = TBIF_BYINDEX;
		int index = ::SendMessage(hwnd, TB_GETBUTTONINFO, i, reinterpret_cast<LPARAM>(&btn));
		if (index != static_cast<int>(i)) {
			return false;
		}

		btn.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
		btn.iImage = image;
		if (::SendMessage(hwnd, TB_SETBUTTONINFO, i, reinterpret_cast<LPARAM>(&btn)) == 0) {
			return false;
		}
	}

	::SendMessage(hwnd, TB_SETINDENT, ConvertDialogToPixels(wxPoint(1, 0)).x, 0);

	return true;
}