diff --git a/src/ui/uxmanager.cpp b/src/ui/uxmanager.cpp
index ae4de62e368351c1b6b41ccc906fe3c8bcda065a..a3ccb347176e7e65132568f064921617602d4d8f 100644 (file)
--- a/src/ui/uxmanager.cpp
+++ b/src/ui/uxmanager.cpp
#include <algorithm>
#include "uxmanager.h"
+#include "desktop.h"
#include "util/ege-tags.h"
#include "widgets/toolbox.h"
#include "widgets/desktop-widget.h"
static map<SPDesktop*, vector<GtkWidget*> > trackedBoxes;
+namespace {
+// TODO unify this later:
+static Glib::ustring getLayoutPrefPath( Inkscape::UI::View::View *view )
+{
+ Glib::ustring prefPath;
+
+ if (reinterpret_cast<SPDesktop*>(view)->is_focusMode()) {
+ prefPath = "/focus/";
+ } else if (reinterpret_cast<SPDesktop*>(view)->is_fullscreen()) {
+ prefPath = "/fullscreen/";
+ } else {
+ prefPath = "/window/";
+ }
+
+ return prefPath;
+}
+
+}
namespace Inkscape {
namespace UI {
UXManagerImpl();
virtual ~UXManagerImpl();
- virtual void setTask(SPDesktop* dt, gint val);
virtual void addTrack( SPDesktopWidget* dtw );
virtual void delTrack( SPDesktopWidget* dtw );
+
virtual void connectToDesktop( vector<GtkWidget *> const & toolboxes, SPDesktop *desktop );
+ virtual gint getDefaultTask( SPDesktop *desktop );
+ virtual void setTask(SPDesktop* dt, gint val);
+
virtual bool isFloatWindowProblem() const;
virtual bool isWidescreen() const;
int width = defaultScreen->get_width();
int height = defaultScreen->get_height();
gdouble aspect = static_cast<gdouble>(width) / static_cast<gdouble>(height);
- if (aspect > 1.4) {
+ if (aspect > 1.65) {
_widescreen = true;
}
}
return _widescreen;
}
+gint UXManagerImpl::getDefaultTask( SPDesktop *desktop )
+{
+ gint taskNum = isWidescreen() ? 2 : 0;
+
+ Glib::ustring prefPath = getLayoutPrefPath( desktop );
+ taskNum = Inkscape::Preferences::get()->getInt( prefPath + "task/taskset", taskNum );
+ taskNum = (taskNum < 0) ? 0 : (taskNum > 2) ? 2 : taskNum;
+
+ return taskNum;
+}
+
void UXManagerImpl::setTask(SPDesktop* dt, gint val)
{
for (vector<SPDesktopWidget*>::iterator it = dtws.begin(); it != dtws.end(); ++it) {
gboolean notDone = Inkscape::Preferences::get()->getBool("/options/workarounds/dynamicnotdone", false);
if (dtw->desktop == dt) {
+ int taskNum = val;
switch (val) {
default:
case 0:
if (notDone) {
dtw->setToolboxPosition("AuxToolbar", GTK_POS_TOP);
}
- dtw->setToolboxPosition("SnapToolbar", GTK_POS_TOP);
+ dtw->setToolboxPosition("SnapToolbar", GTK_POS_RIGHT);
+ taskNum = val; // in case it was out of range
break;
case 1:
- dtw->setToolboxPosition("ToolToolbar", GTK_POS_TOP);
- dtw->setToolboxPosition("CommandsToolbar", GTK_POS_LEFT);
+ dtw->setToolboxPosition("ToolToolbar", GTK_POS_LEFT);
+ dtw->setToolboxPosition("CommandsToolbar", GTK_POS_TOP);
if (notDone) {
dtw->setToolboxPosition("AuxToolbar", GTK_POS_TOP);
}
- dtw->setToolboxPosition("SnapToolbar", GTK_POS_RIGHT);
+ dtw->setToolboxPosition("SnapToolbar", GTK_POS_TOP);
break;
case 2:
dtw->setToolboxPosition("ToolToolbar", GTK_POS_LEFT);
dtw->setToolboxPosition("AuxToolbar", GTK_POS_RIGHT);
}
}
+ Glib::ustring prefPath = getLayoutPrefPath( dtw->desktop );
+ Inkscape::Preferences::get()->setInt( prefPath + "task/taskset", taskNum );
}
}
}
@@ -200,6 +237,11 @@ void UXManagerImpl::connectToDesktop( vector<GtkWidget *> const & toolboxes, SPD
if (std::find(desktops.begin(), desktops.end(), desktop) == desktops.end()) {
desktops.push_back(desktop);
}
+
+ gint taskNum = getDefaultTask( desktop );
+
+ // note: this will change once more options are in the task set support:
+ Inkscape::UI::UXManager::getInstance()->setTask( desktop, taskNum );
}