KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema/dialogs/dialog_image_properties.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <dialogs/dialog_image_properties.h>
26
27#include <sch_edit_frame.h>
28#include <sch_bitmap.h>
29#include <tool/tool_manager.h>
30#include <tool/actions.h>
31
32
34 DIALOG_IMAGE_PROPERTIES_BASE( aParent ), m_frame( aParent ), m_bitmap( aBitmap ),
35 m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ),
36 m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit )
37{
38 // Create the image editor page
40 m_Notebook->AddPage( m_imageEditor, _( "Image" ), false );
41
44
46
48}
49
50
52{
55
56 return true;
57}
58
59
61{
63 {
64 // Save old image in undo list if not already in edit
65 if( m_bitmap->GetEditFlags() == 0 )
66 m_frame->SaveCopyInUndoList( m_frame->GetScreen(), m_bitmap, UNDO_REDO::CHANGED, false,
67 false );
68
69 // Update our bitmap from the editor
71
73
74 return true;
75 }
76
77 return false;
78}
DIALOG_IMAGE_PROPERTIES(SCH_EDIT_FRAME *aParent, SCH_BITMAP *aBitmap)
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:129
void TransferToImage(BITMAP_BASE *aItem)
Function TransferToImage copy edited image to aItem.
bool TransferDataFromWindow() override
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:41
VECTOR2I GetPosition() const override
Definition: sch_bitmap.h:139
BITMAP_BASE * GetImage() const
Definition: sch_bitmap.h:54
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_bitmap.h:140
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
Definition: unit_binder.h:189
#define _(s)
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588