Add display setting preference pane for PLEditor.
Fixes: lp:1839187 * https://bugs.launchpad.net/kicad/+bug/1839187
This commit is contained in:
parent
551eb56da0
commit
0d90fab01b
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -17,16 +17,15 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <lib_edit_frame.h>
|
||||
#include <sch_view.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <view/view.h>
|
||||
#include <widgets/gal_options_panel.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
|
||||
#include <panel_libedit_display_options.h>
|
||||
#include <panel_display_options.h>
|
||||
|
||||
|
||||
PANEL_LIBEDIT_DISPLAY_OPTIONS::PANEL_LIBEDIT_DISPLAY_OPTIONS( LIB_EDIT_FRAME* aFrame,
|
||||
PAGED_DIALOG* aParent ) :
|
||||
PANEL_DISPLAY_OPTIONS::PANEL_DISPLAY_OPTIONS( EDA_DRAW_FRAME* aFrame, PAGED_DIALOG* aParent ) :
|
||||
wxPanel( aParent->GetTreebook(), wxID_ANY ),
|
||||
m_frame( aFrame )
|
||||
{
|
||||
|
@ -45,19 +44,19 @@ PANEL_LIBEDIT_DISPLAY_OPTIONS::PANEL_LIBEDIT_DISPLAY_OPTIONS( LIB_EDIT_FRAME* aF
|
|||
}
|
||||
|
||||
|
||||
bool PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataToWindow()
|
||||
bool PANEL_DISPLAY_OPTIONS::TransferDataToWindow()
|
||||
{
|
||||
m_galOptsPanel->TransferDataToWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_LIBEDIT_DISPLAY_OPTIONS::TransferDataFromWindow()
|
||||
bool PANEL_DISPLAY_OPTIONS::TransferDataFromWindow()
|
||||
{
|
||||
m_galOptsPanel->TransferDataFromWindow();
|
||||
|
||||
// refresh view
|
||||
KIGFX::SCH_VIEW* view = m_frame->GetCanvas()->GetView();
|
||||
KIGFX::VIEW* view = m_frame->GetCanvas()->GetView();
|
||||
view->RecacheAllItems();
|
||||
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||
m_frame->GetCanvas()->Refresh();
|
|
@ -18,26 +18,26 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef KICAD_PANEL_LIBEDIT_DISPLAY_OPTIONS_H
|
||||
#define KICAD_PANEL_LIBEDIT_DISPLAY_OPTIONS_H
|
||||
#ifndef PANEL_DISPLAY_OPTIONS_H
|
||||
#define PANEL_DISPLAY_OPTIONS_H
|
||||
|
||||
#include <wx/panel.h>
|
||||
|
||||
class GAL_OPTIONS_PANEL;
|
||||
class LIB_EDIT_FRAME;
|
||||
class EDA_DRAW_FRAME;
|
||||
class PAGED_DIALOG;
|
||||
|
||||
class PANEL_LIBEDIT_DISPLAY_OPTIONS : public wxPanel
|
||||
class PANEL_DISPLAY_OPTIONS : public wxPanel
|
||||
{
|
||||
public:
|
||||
PANEL_LIBEDIT_DISPLAY_OPTIONS( LIB_EDIT_FRAME* aParent, PAGED_DIALOG* aWindow );
|
||||
PANEL_DISPLAY_OPTIONS( EDA_DRAW_FRAME* aParent, PAGED_DIALOG* aWindow );
|
||||
|
||||
private:
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
LIB_EDIT_FRAME* m_frame;
|
||||
EDA_DRAW_FRAME* m_frame;
|
||||
GAL_OPTIONS_PANEL* m_galOptsPanel;
|
||||
};
|
||||
|
||||
#endif //KICAD_PANEL_LIBEDIT_DISPLAY_OPTIONS_H
|
||||
#endif //PANEL_DISPLAY_OPTIONS_H
|
|
@ -94,7 +94,6 @@ set( EESCHEMA_DLGS
|
|||
dialogs/panel_eeschema_display_options_base.cpp
|
||||
dialogs/panel_eeschema_settings.cpp
|
||||
dialogs/panel_eeschema_settings_base.cpp
|
||||
dialogs/panel_libedit_display_options.cpp
|
||||
dialogs/panel_libedit_settings.cpp
|
||||
dialogs/panel_libedit_settings_base.cpp
|
||||
dialogs/panel_sym_lib_table.cpp
|
||||
|
@ -237,6 +236,7 @@ set( EESCHEMA_SRCS
|
|||
|
||||
set( EESCHEMA_COMMON_SRCS
|
||||
../common/dialogs/dialog_page_settings.cpp
|
||||
../common/dialogs/panel_display_options.cpp
|
||||
../common/base_screen.cpp
|
||||
../common/base_units.cpp
|
||||
../common/eda_text.cpp
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <dialogs/panel_eeschema_template_fieldnames.h>
|
||||
#include <dialogs/panel_eeschema_settings.h>
|
||||
#include <dialogs/panel_eeschema_display_options.h>
|
||||
#include <dialogs/panel_libedit_display_options.h>
|
||||
#include <panel_display_options.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include <widgets/widget_eeschema_color_config.h>
|
||||
#include <widgets/symbol_tree_pane.h>
|
||||
|
@ -461,7 +461,7 @@ void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
|||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new PANEL_LIBEDIT_SETTINGS( this, book ), _( "Symbol Editor" ) );
|
||||
book->AddSubPage( new PANEL_LIBEDIT_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
|
||||
aHotkeysPanel->AddHotKeys( GetToolManager() );
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ set( PL_EDITOR_EXTRA_SRCS
|
|||
../common/base_units.cpp
|
||||
../common/eda_text.cpp
|
||||
../common/dialogs/dialog_page_settings.cpp
|
||||
../common/dialogs/panel_display_options.cpp
|
||||
../common/page_info.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
#include <pl_editor_screen.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <properties_frame.h>
|
||||
#include <widgets/paged_dialog.h>
|
||||
#include <panel_display_options.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include <view/view.h>
|
||||
#include <confirm.h>
|
||||
#include <tool/selection.h>
|
||||
|
@ -54,7 +57,6 @@
|
|||
#include <invoke_pl_editor_dialog.h>
|
||||
#include <tools/pl_editor_control.h>
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
|
||||
EVT_MENU( wxID_CLOSE, PL_EDITOR_FRAME::OnExit )
|
||||
|
@ -117,11 +119,6 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU();
|
||||
SetScreen( new PL_EDITOR_SCREEN( pageSizeIU ) );
|
||||
|
||||
if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1MM - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
|
||||
|
||||
setupTools();
|
||||
ReCreateMenuBar();
|
||||
ReCreateHToolbar();
|
||||
|
@ -186,6 +183,11 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
wxPoint originCoord = ReturnCoordOriginCorner();
|
||||
SetGridOrigin( originCoord );
|
||||
|
||||
if( !GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1MM - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
|
||||
|
||||
// Initialize the current page layout
|
||||
WS_DATA_MODEL& pglayout = WS_DATA_MODEL::GetTheInstance();
|
||||
#if 0 //start with empty layout
|
||||
|
@ -388,6 +390,17 @@ double PL_EDITOR_FRAME::BestZoom()
|
|||
}
|
||||
|
||||
|
||||
void PL_EDITOR_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
||||
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
|
||||
{
|
||||
wxTreebook* book = aParent->GetTreebook();
|
||||
|
||||
book->AddPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
|
||||
aHotkeysPanel->AddHotKeys( GetToolManager() );
|
||||
}
|
||||
|
||||
|
||||
static const wxChar propertiesFrameWidthKey[] = wxT( "PropertiesFrameWidth" );
|
||||
static const wxChar cornerOriginChoiceKey[] = wxT( "CornerOriginChoice" );
|
||||
static const wxChar blackBgColorKey[] = wxT( "BlackBgColor" );
|
||||
|
@ -550,17 +563,9 @@ void PL_EDITOR_FRAME::DisplayGridMsg()
|
|||
|
||||
switch( m_userUnits )
|
||||
{
|
||||
case INCHES:
|
||||
gridformatter = "grid %.3f";
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
gridformatter = "grid %.4f";
|
||||
break;
|
||||
|
||||
default:
|
||||
gridformatter = "grid %f";
|
||||
break;
|
||||
case INCHES: gridformatter = "grid %.3f"; break;
|
||||
case MILLIMETRES: gridformatter = "grid %.4f"; break;
|
||||
default: gridformatter = "grid %f"; break;
|
||||
}
|
||||
|
||||
wxRealPoint curr_grid_size = GetScreen()->GetGridSize();
|
||||
|
@ -681,7 +686,7 @@ void PL_EDITOR_FRAME::HardRedraw()
|
|||
|
||||
PL_SELECTION_TOOL* selTool = m_toolManager->GetTool<PL_SELECTION_TOOL>();
|
||||
PL_SELECTION& selection = selTool->GetSelection();
|
||||
WS_DATA_ITEM* item = nullptr;
|
||||
WS_DATA_ITEM* item = nullptr;
|
||||
|
||||
if( selection.GetSize() == 1 )
|
||||
item = static_cast<WS_DRAW_ITEM_BASE*>( selection.Front() )->GetPeer();
|
||||
|
|
|
@ -206,6 +206,8 @@ public:
|
|||
*/
|
||||
void UpdateTitleAndInfo();
|
||||
|
||||
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
|
||||
|
||||
/**
|
||||
* Populates the applicatios settings list.
|
||||
* (list of parameters that must be saved in project parameters)
|
||||
|
|
Loading…
Reference in New Issue