Kaydet (Commit) caf72fd8 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld FloatingContour

Change-Id: I055f01d2ce462009986801d4a603b0b72b1a621c
Reviewed-on: https://gerrit.libreoffice.org/72787
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 8b7f8f54
......@@ -381,9 +381,6 @@
generic-name="DriverListControl" parent="GtkEntry"
icon-name="widget-gtk-combobox"/>
<glade-widget-class title="Statusbar" name="svxlo-StatusBar"
generic-name="Statusbar" parent="GtkStatusbar"
icon-name="widget-gtk-statusbar"/>
<glade-widget-class title="DataTreeListBox" name="svxcorelo-DataTreeListBox"
generic-name="DataTreeListBox" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
......
......@@ -50,12 +50,9 @@ public:
class SvxSuperContourDlg;
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxContourDlg : public SfxFloatingWindow
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxContourDlg : public SfxModelessDialogController
{
using Window::Update;
VclPtr<SvxSuperContourDlg> pSuperClass;
std::unique_ptr<SvxSuperContourDlg> m_xImpl;
protected:
......@@ -63,15 +60,13 @@ protected:
public:
SvxContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent);
SvxContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW, weld::Window* pParent);
virtual ~SvxContourDlg() override;
virtual void dispose() override;
const Graphic& GetGraphic() const;
bool IsGraphicChanged() const;
tools::PolyPolygon GetPolyPolygon();
tools::PolyPolygon GetPolyPolygon();
const void* GetEditingObject() const;
......
......@@ -477,7 +477,6 @@ custom_widgets = [
'SidebarDialControl',
'SidebarToolBox',
'SpacingListBox',
'StatusBar',
'SvSimpleTableContainer',
'SvTreeListBox',
'SvtFileView',
......
......@@ -37,6 +37,8 @@ svx/uiconfig/ui/findreplacedialog.ui://GtkLabel[@id='label7'] orphan-label
svx/uiconfig/ui/findreplacedialog.ui://GtkLabel[@id='searchinlabel'] orphan-label
svx/uiconfig/ui/findreplacedialog.ui://GtkComboBoxText[@id='calcsearchin'] no-labelled-by
svx/uiconfig/ui/findreplacedialog.ui://GtkLabel[@id='searchdir'] orphan-label
svx/uiconfig/ui/floatingcontour.ui://GtkLabel[@id='statuspos'] orphan-label
svx/uiconfig/ui/floatingcontour.ui://GtkLabel[@id='statussize'] orphan-label
svx/uiconfig/ui/fontworkgallerydialog.ui://GtkLabel[@id='label1'] orphan-label
svx/uiconfig/ui/headfootformatpage.ui://GtkLabel[@id='labelHeaderFormat'] orphan-label
svx/uiconfig/ui/headfootformatpage.ui://GtkLabel[@id='labelFooterFormat'] orphan-label
......
This diff is collapsed.
......@@ -21,8 +21,6 @@
#include <svx/contdlg.hxx>
#include "contwnd.hxx"
#include <vcl/toolbox.hxx>
#include <vcl/status.hxx>
#include <vcl/idle.hxx>
class SvxSuperContourDlg;
......@@ -40,63 +38,77 @@ public:
SvxContourDlgItem( SvxSuperContourDlg& rDlg, SfxBindings& rBindings );
};
class SvxSuperContourDlg : public SvxContourDlg
class ContourWindow;
class StatusColor : public weld::CustomWidgetController
{
using SvxContourDlg::GetPolyPolygon;
private:
ContourWindow& m_rWnd;
public:
StatusColor(ContourWindow& rWnd)
: m_rWnd(rWnd)
{
}
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
{
weld::CustomWidgetController::SetDrawingArea(pDrawingArea);
Size aSize(pDrawingArea->get_approximate_digit_width() * 3,
pDrawingArea->get_text_height());
pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
SetOutputSizePixel(aSize);
}
};
class SvxSuperContourDlg
{
Graphic aGraphic;
Graphic aUndoGraphic;
Graphic aRedoGraphic;
Graphic aUpdateGraphic;
tools::PolyPolygon aUpdatePolyPoly;
tools::PolyPolygon aUpdatePolyPoly;
Idle aUpdateIdle;
Idle aCreateIdle;
SfxBindings* mpBindings;
void* pUpdateEditingObject;
void* pCheckObj;
SvxContourDlgItem aContourItem;
VclPtr<ToolBox> m_pTbx1;
VclPtr<MetricField> m_pMtfTolerance;
VclPtr<ContourWindow> m_pContourWnd;
VclPtr<StatusBar> m_pStbStatus;
sal_Int32 mnGrfChanged;
bool bExecState;
bool bUpdateGraphicLinked;
bool bGraphicLinked;
sal_uInt16 mnApplyId;
sal_uInt16 mnWorkSpaceId;
sal_uInt16 mnSelectId;
sal_uInt16 mnRectId;
sal_uInt16 mnCircleId;
sal_uInt16 mnPolyId;
sal_uInt16 mnPolyEditId;
sal_uInt16 mnPolyMoveId;
sal_uInt16 mnPolyInsertId;
sal_uInt16 mnPolyDeleteId;
sal_uInt16 mnAutoContourId;
sal_uInt16 mnUndoId;
sal_uInt16 mnRedoId;
sal_uInt16 mnPipetteId;
virtual bool Close() override;
DECL_LINK( Tbx1ClickHdl, ToolBox*, void );
DECL_LINK( MousePosHdl, GraphCtrl*, void );
DECL_LINK( GraphSizeHdl, GraphCtrl*, void );
DECL_LINK( UpdateHdl, Timer *, void );
DECL_LINK( CreateHdl, Timer *, void );
DECL_LINK( StateHdl, GraphCtrl*, void );
DECL_LINK( PipetteHdl, ContourWindow&, void );
DECL_LINK( PipetteClickHdl, ContourWindow&, void );
DECL_LINK( WorkplaceClickHdl, ContourWindow&, void );
DECL_LINK( MiscHdl, LinkParamNone*, void );
weld::Dialog& m_rDialog;
std::unique_ptr<ContourWindow> m_xContourWnd;
std::unique_ptr<StatusColor> m_xStbStatusColor;
std::unique_ptr<weld::Toolbar> m_xTbx1;
std::unique_ptr<weld::MetricSpinButton> m_xMtfTolerance;
std::unique_ptr<weld::Label> m_xStbStatus2;
std::unique_ptr<weld::Label> m_xStbStatus3;
std::unique_ptr<weld::Button> m_xCancelBtn;
std::unique_ptr<weld::CustomWeld> m_xStbStatusColorWeld;
std::unique_ptr<weld::CustomWeld> m_xContourWndWeld;
DECL_LINK( Tbx1ClickHdl, const OString&, void );
DECL_LINK( MousePosHdl, SvxGraphCtrl*, void );
DECL_LINK( GraphSizeHdl, SvxGraphCtrl*, void );
DECL_LINK( UpdateHdl, Timer *, void );
DECL_LINK( CreateHdl, Timer *, void );
DECL_LINK( StateHdl, SvxGraphCtrl*, void );
DECL_LINK( PipetteHdl, ContourWindow&, void );
DECL_LINK( PipetteClickHdl, ContourWindow&, void );
DECL_LINK( WorkplaceClickHdl, ContourWindow&, void );
DECL_LINK( CancelHdl, weld::Button&, void );
void SetActiveTool(const OString& rId);
void SetActivePoly(const OString& rId);
SfxBindings& GetBindings() { return *mpBindings; }
public:
SvxSuperContourDlg(SfxBindings *pBindings, SfxChildWindow *pCW,
vcl::Window* pParent);
virtual ~SvxSuperContourDlg() override;
virtual void dispose() override;
SvxSuperContourDlg(weld::Builder& rBuilder, weld::Dialog& rDialog, SfxBindings* pBindings);
~SvxSuperContourDlg();
void SetExecState( bool bEnable );
......
......@@ -33,14 +33,13 @@ using namespace css;
#define TRANSCOL COL_WHITE
ContourWindow::ContourWindow(vcl::Window* pParent, WinBits nBits)
: GraphCtrl (pParent, nBits)
ContourWindow::ContourWindow(weld::Dialog* pDialog)
: SvxGraphCtrl(pDialog)
, aWorkRect(0, 0, 0, 0)
, bPipetteMode(false)
, bWorkplaceMode(false)
, bClickValid(false)
{
SetSdrMode(true);
}
void ContourWindow::SetPolyPolygon(const tools::PolyPolygon& rPolyPoly)
......@@ -112,7 +111,7 @@ const tools::PolyPolygon& ContourWindow::GetPolyPolygon()
void ContourWindow::InitSdrModel()
{
GraphCtrl::InitSdrModel();
SvxGraphCtrl::InitSdrModel();
SfxItemSet aSet( pModel->GetItemPool() );
......@@ -139,11 +138,11 @@ bool ContourWindow::IsContourChanged() const
return bRet;
}
void ContourWindow::MouseButtonDown( const MouseEvent& rMEvt )
bool ContourWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( bWorkplaceMode )
{
const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
const Point aLogPt(GetDrawingArea()->get_ref_device().PixelToLogic(rMEvt.GetPosPixel()));
SetPolyPolygon( tools::PolyPolygon() );
aWorkRect = tools::Rectangle( aLogPt, aLogPt );
......@@ -151,48 +150,54 @@ void ContourWindow::MouseButtonDown( const MouseEvent& rMEvt )
SetEditMode( true );
}
if ( !bPipetteMode )
GraphCtrl::MouseButtonDown( rMEvt );
if (!bPipetteMode)
return SvxGraphCtrl::MouseButtonDown( rMEvt );
return true;
}
void ContourWindow::MouseMove( const MouseEvent& rMEvt )
bool ContourWindow::MouseMove( const MouseEvent& rMEvt )
{
bClickValid = false;
if ( bPipetteMode )
{
const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
const Point aLogPt( GetDrawingArea()->get_ref_device().PixelToLogic( rMEvt.GetPosPixel() ) );
aPipetteColor = GetPixel( aLogPt );
Control::MouseMove( rMEvt );
aPipetteColor = GetDrawingArea()->get_ref_device().GetPixel( aLogPt );
weld::CustomWidgetController::MouseMove( rMEvt );
if ( aPipetteLink.IsSet() && tools::Rectangle( Point(), GetGraphicSize() ).IsInside( aLogPt ) )
{
SetPointer( PointerStyle::RefHand );
aPipetteLink.Call( *this );
}
return true;
}
else
GraphCtrl::MouseMove( rMEvt );
return SvxGraphCtrl::MouseMove( rMEvt );
}
void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
bool ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
{
const tools::Rectangle aGraphRect( Point(), GetGraphicSize() );
const Point aLogPt( PixelToLogic( rMEvt.GetPosPixel() ) );
const Point aLogPt( GetDrawingArea()->get_ref_device().PixelToLogic( rMEvt.GetPosPixel() ) );
bClickValid = aGraphRect.IsInside( aLogPt );
ReleaseMouse();
if ( bPipetteMode )
{
Control::MouseButtonUp( rMEvt );
weld::CustomWidgetController::MouseButtonUp( rMEvt );
aPipetteClickLink.Call( *this );
return true;
}
else if ( bWorkplaceMode )
{
GraphCtrl::MouseButtonUp( rMEvt );
SvxGraphCtrl::MouseButtonUp( rMEvt );
aWorkRect.SetRight( aLogPt.X() );
aWorkRect.SetBottom( aLogPt.Y() );
......@@ -213,9 +218,11 @@ void ContourWindow::MouseButtonUp(const MouseEvent& rMEvt)
Invalidate( aGraphRect );
aWorkplaceClickLink.Call( *this );
return false;
}
else
GraphCtrl::MouseButtonUp( rMEvt );
return SvxGraphCtrl::MouseButtonUp( rMEvt );
}
void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
......@@ -224,6 +231,7 @@ void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
// encapsulate the redraw using Begin/End and use the returned
// data to get the target output device (e.g. when pre-rendering)
SdrPaintWindow* pPaintWindow = pView->BeginCompleteRedraw(&rRenderContext);
pPaintWindow->SetOutputToWindow(true);
OutputDevice& rTarget = pPaintWindow->GetTargetOutputDevice();
const Graphic& rGraphic = GetGraphic();
......@@ -253,9 +261,13 @@ void ContourWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Recta
pView->EndCompleteRedraw(*pPaintWindow, true);
}
Size ContourWindow::GetOptimalSize() const
void ContourWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea)
{
return LogicToPixel(Size(270, 170), MapMode(MapUnit::MapAppFont));
SvxGraphCtrl::SetDrawingArea(pDrawingArea);
Size aSize(pDrawingArea->get_ref_device().LogicToPixel(Size(270, 170), MapMode(MapUnit::MapAppFont)));
pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
SetOutputSizePixel(aSize);
SetSdrMode(true);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -23,7 +23,7 @@
#include <tools/poly.hxx>
#include <svx/graphctl.hxx>
class ContourWindow : public GraphCtrl
class ContourWindow final : public SvxGraphCtrl
{
tools::PolyPolygon aPolyPoly;
Color aPipetteColor;
......@@ -35,19 +35,17 @@ class ContourWindow : public GraphCtrl
bool bWorkplaceMode;
bool bClickValid;
protected:
virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
virtual void MouseMove(const MouseEvent& rMEvt) override;
virtual void MouseButtonUp(const MouseEvent& rMEvt) override;
virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
virtual bool MouseMove(const MouseEvent& rMEvt) override;
virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
virtual void SdrObjCreated( const SdrObject& rObj ) override;
virtual void InitSdrModel() override;
virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
virtual Size GetOptimalSize() const override;
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
public:
ContourWindow(vcl::Window* pParent, WinBits nBits);
ContourWindow(weld::Dialog* pDialog);
void SetPolyPolygon( const tools::PolyPolygon& rPolyPoly );
const tools::PolyPolygon& GetPolyPolygon();
......
......@@ -107,8 +107,6 @@ void SvxIMapDlgChildWindow::UpdateIMapDlg( const Graphic& rGraphic, const ImageM
pDlg->UpdateLink(rGraphic, pImageMap, pTargetList, pEditingObj);
}
VCL_BUILDER_FACTORY(StatusBar)
SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, weld::Window* _pParent)
: SfxModelessDialogController(_pBindings, pCW, _pParent, "svx/ui/imapdialog.ui", "ImapDialog")
, pCheckObj(nullptr)
......@@ -707,18 +705,19 @@ IMPL_LINK( SvxIMapDlg, StateHdl, SvxGraphCtrl*, pWnd, void )
if ( bPolyEdit )
{
OString sId;
switch( pWnd->GetPolyEditMode() )
{
case SID_BEZIER_MOVE: sId = "TBI_POLYMOVE"; break;
case SID_BEZIER_INSERT: sId = "TBI_POLYINSERT"; break;
case SID_BEZIER_MOVE:
m_xTbxIMapDlg1->set_item_active("TBI_POLYMOVE", true);
m_xTbxIMapDlg1->set_item_active("TBI_POLYINSERT", false);
break;
case SID_BEZIER_INSERT:
m_xTbxIMapDlg1->set_item_active("TBI_POLYINSERT", true);
m_xTbxIMapDlg1->set_item_active("TBI_POLYMOVE", false);
break;
default:
break;
break;
}
m_xTbxIMapDlg1->set_item_active(sId, true);
}
else
{
......
......@@ -139,7 +139,7 @@
<property name="hexpand">True</property>
<property name="toolbar_style">icons</property>
<property name="show_arrow">False</property>
<property name="icon_size">1</property>
<property name="icon_size">2</property>
<child>
<object class="GtkToolButton" id="TBI_APPLY">
<property name="visible">True</property>
......
......@@ -137,10 +137,8 @@ namespace
{
SvxContourDlg* GetContourDlg(SwView const &rView)
{
SfxChildWindow *pChildWindow = rView.GetViewFrame()->GetChildWindow(
SvxContourDlgChildWindow::GetChildWindowId());
return pChildWindow ? static_cast<SvxContourDlg*>(pChildWindow->GetWindow()) : nullptr;
SfxChildWindow *pWnd = rView.GetViewFrame()->GetChildWindow(SvxContourDlgChildWindow::GetChildWindowId());
return pWnd ? static_cast<SvxContourDlg*>(pWnd->GetController().get()) : nullptr;
}
SvxIMapDlg* GetIMapDlg(SwView const &rView)
......
......@@ -5353,9 +5353,12 @@ private:
static void collect(GtkWidget* pItem, gpointer widget)
{
GtkToolButton* pToolItem = GTK_TOOL_BUTTON(pItem);
GtkInstanceToolbar* pThis = static_cast<GtkInstanceToolbar*>(widget);
pThis->add_to_map(pToolItem);
if (GTK_IS_TOOL_BUTTON(pItem))
{
GtkToolButton* pToolItem = GTK_TOOL_BUTTON(pItem);
GtkInstanceToolbar* pThis = static_cast<GtkInstanceToolbar*>(widget);
pThis->add_to_map(pToolItem);
}
}
void add_to_map(GtkToolButton* pToolItem)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment