summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libvpsc/CMakeLists.txt2
-rw-r--r--src/libvpsc/Makefile_insert2
-rw-r--r--src/libvpsc/csolve_VPSC.cpp128
-rw-r--r--src/libvpsc/csolve_VPSC.h72
-rw-r--r--src/ui/dialog/input.cpp82
5 files changed, 43 insertions, 243 deletions
diff --git a/src/libvpsc/CMakeLists.txt b/src/libvpsc/CMakeLists.txt
index 4099900b5..aa693670c 100644
--- a/src/libvpsc/CMakeLists.txt
+++ b/src/libvpsc/CMakeLists.txt
@@ -3,7 +3,6 @@ set(libvpsc_SRC
block.cpp
blocks.cpp
constraint.cpp
- csolve_VPSC.cpp
generate-constraints.cpp
remove_rectangle_overlap.cpp
solve_VPSC.cpp
@@ -16,7 +15,6 @@ set(libvpsc_SRC
block.h
blocks.h
constraint.h
- csolve_VPSC.h
generate-constraints.h
pairingheap/PairingHeap.h
pairingheap/dsexceptions.h
diff --git a/src/libvpsc/Makefile_insert b/src/libvpsc/Makefile_insert
index 4af86324e..cb05be6c0 100644
--- a/src/libvpsc/Makefile_insert
+++ b/src/libvpsc/Makefile_insert
@@ -11,7 +11,6 @@ libvpsc_libvpsc_a_SOURCES = libvpsc/block.cpp\
libvpsc/pairingheap/PairingHeap.cpp\
libvpsc/remove_rectangle_overlap.cpp\
libvpsc/solve_VPSC.cpp\
- libvpsc/csolve_VPSC.cpp\
libvpsc/variable.cpp\
libvpsc/block.h\
libvpsc/blocks.h\
@@ -21,5 +20,4 @@ libvpsc_libvpsc_a_SOURCES = libvpsc/block.cpp\
libvpsc/pairingheap/dsexceptions.h\
libvpsc/remove_rectangle_overlap.h\
libvpsc/solve_VPSC.h\
- libvpsc/csolve_VPSC.h\
libvpsc/variable.h
diff --git a/src/libvpsc/csolve_VPSC.cpp b/src/libvpsc/csolve_VPSC.cpp
deleted file mode 100644
index 60e88a50b..000000000
--- a/src/libvpsc/csolve_VPSC.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Bridge for C programs to access solve_VPSC (which is in C++).
- *
- * Authors:
- * Tim Dwyer <tgdwyer@gmail.com>
- *
- * Copyright (C) 2005 Authors
- *
- * Released under GNU LGPL. Read the file 'COPYING' for more information.
- */
-#include <glib.h>
-#include <iostream>
-#include <cassert>
-#include <cstdlib>
-#include "variable.h"
-#include "constraint.h"
-#include "generate-constraints.h"
-#include "solve_VPSC.h"
-#include "csolve_VPSC.h"
-using namespace vpsc;
-extern "C" {
-Variable* newVariable(int id, double desiredPos, double weight) {
- return new Variable(id,desiredPos,weight);
-}
-Constraint* newConstraint(Variable* left, Variable* right, double gap) {
- return new Constraint(left,right,gap);
-}
-Solver* newSolver(int n, Variable* vs[], int m, Constraint* cs[]) {
- return new Solver(n,vs,m,cs);
-}
-Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]) {
- return (Solver*)new vpsc::IncSolver(n,vs,m,cs);
-}
-
-int genXConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs,int transitiveClosure) {
- Rectangle* rs[n];
- for(int i=0;i<n;i++) {
- rs[i]=new Rectangle(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
- }
- int m = generateXConstraints(n,rs,vs,*cs,transitiveClosure);
- for(int i=0;i<n;i++) {
- delete rs[i];
- }
- return m;
-}
-int genYConstraints(int n, boxf* bb, Variable** vs, Constraint*** cs) {
- g_assert(n > 0);
- Rectangle* rs[n];
- for(int i=0;i<n;i++) {
- rs[i]=new Rectangle(bb[i].LL.x,bb[i].UR.x,bb[i].LL.y,bb[i].UR.y);
- }
- int m = generateYConstraints(n,rs,vs,*cs);
- for(int i=0;i<n;i++) {
- delete rs[i];
- }
- return m;
-}
-
-Constraint** newConstraints(int m) {
- return new Constraint*[m];
-}
-void deleteConstraints(int m, Constraint **cs) {
- for(int i=0;i<m;i++) {
- delete cs[i];
- }
- delete [] cs;
-}
-void deleteConstraint(Constraint* c) {
- delete c;
-}
-void deleteVariable(Variable* v) {
- delete v;
-}
-void satisfyVPSC(Solver* vpsc) {
- try {
- vpsc->satisfy();
- } catch(const char *e) {
- std::cerr << e << std::endl;
- exit(1);
- }
-}
-int getSplitCnt(IncSolver *vpsc) {
- return vpsc->splitCnt;
-}
-void deleteVPSC(Solver *vpsc) {
- assert(vpsc!=NULL);
- delete vpsc;
-}
-void solveVPSC(Solver* vpsc) {
- vpsc->solve();
-}
-void splitIncVPSC(IncSolver* vpsc) {
- vpsc->splitBlocks();
-}
-void setVariableDesiredPos(Variable *v, double desiredPos) {
- v->desiredPosition = desiredPos;
-}
-double getVariablePos(Variable *v) {
- return v->position();
-}
-void remapInConstraints(Variable *u, Variable *v, double dgap) {
- for(Constraints::iterator i=u->in.begin();i!=u->in.end();i++) {
- Constraint* c=*i;
- c->right=v;
- c->gap+=dgap;
- v->in.push_back(c);
- }
- u->in.clear();
-}
-void remapOutConstraints(Variable *u, Variable *v, double dgap) {
- for(Constraints::iterator i=u->out.begin();i!=u->out.end();i++) {
- Constraint* c=*i;
- c->left=v;
- c->gap+=dgap;
- v->out.push_back(c);
- }
- u->out.clear();
-}
-int getLeftVarID(Constraint *c) {
- return c->left->id;
-}
-int getRightVarID(Constraint *c){
- return c->right->id;
-}
-double getSeparation(Constraint *c){
- return c->gap;
-}
-}
diff --git a/src/libvpsc/csolve_VPSC.h b/src/libvpsc/csolve_VPSC.h
deleted file mode 100644
index edfd16657..000000000
--- a/src/libvpsc/csolve_VPSC.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * @file
- * Bridge for C programs to access solve_VPSC (which is in C++).
- */
-/*
- * Authors:
- * Tim Dwyer <tgdwyer@gmail.com>
- *
- * Copyright (C) 2005 Authors
- *
- * Released under GNU LGPL. Read the file 'COPYING' for more information.
- */
-#ifndef CSOLVE_VPSC_H_
-#define CSOLVE_VPSC_H_
-#ifdef __cplusplus
-namespace vpsc
-{
- class Variable;
- class Constraint;
- class Solver;
- class IncSolver;
-}
-/* TODO 'using' should never be in a .h file. We need a different approach here. */
-using vpsc::Variable;
-using vpsc::Constraint;
-using vpsc::Solver;
-using vpsc::IncSolver;
-extern "C" {
-#else
-typedef struct Variable Variable;
-typedef struct Constraint Constraint;
-typedef struct Solver Solver;
-typedef struct IncSolver IncSolver;
-#endif
-
-Variable* newVariable(int id, double desiredPos, double weight);
-void setVariableDesiredPos(Variable *, double desiredPos);
-double getVariablePos(Variable*);
-
-Constraint* newConstraint(Variable* left, Variable* right, double gap);
-
-Solver* newSolver(int n, Variable* vs[], int m, Constraint* cs[]);
-void deleteSolver(Solver*);
-void deleteConstraint(Constraint*);
-void deleteVariable(Variable*);
-Constraint** newConstraints(int m);
-void deleteConstraints(int m,Constraint**);
-void remapInConstraints(Variable *u, Variable *v, double dgap);
-void remapOutConstraints(Variable *u, Variable *v, double dgap);
-int getLeftVarID(Constraint *c);
-int getRightVarID(Constraint *c);
-double getSeparation(Constraint *c);
-
-#ifndef HAVE_POINTF_S
-typedef struct pointf_s { double x, y; } pointf;
-typedef struct { pointf LL, UR; } boxf;
-#endif
-int genXConstraints(int n, boxf[], Variable** vs, Constraint*** cs,
- int transitiveClosure);
-int genYConstraints(int n, boxf[], Variable** vs, Constraint*** cs);
-
-void satisfyVPSC(Solver*);
-void deleteVPSC(Solver*);
-void solveVPSC(Solver*);
-void splitIncVPSC(IncSolver*);
-Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]);
-void splitIncSolver(IncSolver*);
-int getSplitCnt(IncSolver *vpsc);
-#ifdef __cplusplus
-}
-#endif
-#endif /* CSOLVE_VPSC_H_ */
diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp
index 82e65435d..2d4755fd2 100644
--- a/src/ui/dialog/input.cpp
+++ b/src/ui/dialog/input.cpp
@@ -53,10 +53,10 @@
/* XPM */
static char const * core_xpm[] = {
"16 16 4 1",
-" c None",
-". c #808080",
-"+ c #000000",
-"@ c #FFFFFF",
+" c None",
+". c #808080",
+"+ c #000000",
+"@ c #FFFFFF",
" ",
" ",
" ",
@@ -291,9 +291,9 @@ static char const *button_on[] = {
/* XPM */
static char const * axis_none_xpm[] = {
"24 8 3 1",
-" c None",
-". c #000000",
-"+ c #808080",
+" c None",
+". c #000000",
+"+ c #808080",
" ",
" .++++++++++++++++++. ",
" .+ . .+. ",
@@ -305,10 +305,10 @@ static char const * axis_none_xpm[] = {
/* XPM */
static char const * axis_off_xpm[] = {
"24 8 4 1",
-" c None",
-". c #808080",
-"+ c #000000",
-"@ c #FFFFFF",
+" c None",
+". c #808080",
+"+ c #000000",
+"@ c #FFFFFF",
" ",
" .++++++++++++++++++. ",
" .+@@@@@@@@@@@@@@@@@@+. ",
@@ -320,9 +320,9 @@ static char const * axis_off_xpm[] = {
/* XPM */
static char const * axis_on_xpm[] = {
"24 8 3 1",
-" c None",
-". c #000000",
-"+ c #00FF00",
+" c None",
+". c #000000",
+"+ c #00FF00",
" ",
" .................... ",
" ..++++++++++++++++++.. ",
@@ -1707,9 +1707,9 @@ void InputDialogImpl::updateTestAxes( Glib::ustring const& key, GdkDevice* dev )
axesValues[i].set_sensitive(true);
if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
// FIXME: Device axis ranges are inaccessible in GTK+ 3 and
- // are deprecated in GTK+ 2. Progress-bar ranges are disabled
- // until we find an alternative solution
-
+ // are deprecated in GTK+ 2. Progress-bar ranges are disabled
+ // until we find an alternative solution
+
// if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
axesValues[i].set_sensitive(true);
// axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) );
@@ -1726,10 +1726,10 @@ void InputDialogImpl::updateTestAxes( Glib::ustring const& key, GdkDevice* dev )
if ( dev && (i < static_cast<gint>(G_N_ELEMENTS(axesValues)) ) ) {
// FIXME: Device axis ranges are inaccessible in GTK+ 3 and
- // are deprecated in GTK+ 2. Progress-bar ranges are disabled
- // until we find an alternative solution
+ // are deprecated in GTK+ 2. Progress-bar ranges are disabled
+ // until we find an alternative solution
- // if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
+ // if ( (dev->axes[i].max - dev->axes[i].min) > epsilon ) {
axesValues[i].set_sensitive(true);
// axesValues[i].set_fraction( (axesMap[key][i].second- dev->axes[i].min) / (dev->axes[i].max - dev->axes[i].min) );
// }
@@ -1860,8 +1860,8 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
GdkEventButton* btnEvt = reinterpret_cast<GdkEventButton*>(event);
if ( btnEvt->device ) {
key = getKeyFor(btnEvt->device);
- source = gdk_device_get_source(btnEvt->device);
- devName = gdk_device_get_name(btnEvt->device);
+ source = gdk_device_get_source(btnEvt->device);
+ devName = gdk_device_get_name(btnEvt->device);
mapAxesValues(key, btnEvt->axes, btnEvt->device);
if ( buttonMap[key].find(btnEvt->button) == buttonMap[key].end() ) {
@@ -1889,8 +1889,8 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
GdkEventMotion* btnMtn = reinterpret_cast<GdkEventMotion*>(event);
if ( btnMtn->device ) {
key = getKeyFor(btnMtn->device);
- source = gdk_device_get_source(btnMtn->device);
- devName = gdk_device_get_name(btnMtn->device);
+ source = gdk_device_get_source(btnMtn->device);
+ devName = gdk_device_get_name(btnMtn->device);
mapAxesValues(key, btnMtn->axes, btnMtn->device);
}
gchar* name = gtk_accelerator_name(0, static_cast<GdkModifierType>(btnMtn->state));
@@ -1915,19 +1915,16 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
if ( (lastSourceSeen != source) || (lastDevnameSeen != devName) ) {
switch (source) {
- case GDK_SOURCE_MOUSE:
- {
+ case GDK_SOURCE_MOUSE: {
testThumb.set(getPix(PIX_CORE));
+ break;
}
- break;
- case GDK_SOURCE_CURSOR:
- {
-// g_message("flip to cursor");
+ case GDK_SOURCE_CURSOR: {
+// g_message("flip to cursor");
testThumb.set(getPix(PIX_MOUSE));
+ break;
}
- break;
- case GDK_SOURCE_PEN:
- {
+ case GDK_SOURCE_PEN: {
if (devName == _("pad")) {
// g_message("flip to pad");
testThumb.set(getPix(PIX_SIDEBUTTONS));
@@ -1935,17 +1932,24 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
// g_message("flip to pen");
testThumb.set(getPix(PIX_TIP));
}
+ break;
}
- break;
- case GDK_SOURCE_ERASER:
- {
+ case GDK_SOURCE_ERASER: {
// g_message("flip to eraser");
testThumb.set(getPix(PIX_ERASER));
+ break;
}
- break;
-// default:
-// g_message("gurgle");
+#if WITH_GTKMM_3_0
+ /// \fixme GTK3 added new GDK_SOURCEs that should be handled here!
+ case GDK_SOURCE_KEYBOARD:
+ case GDK_SOURCE_TOUCHSCREEN:
+ case GDK_SOURCE_TOUCHPAD: {
+ g_warning("InputDialogImpl::eventSnoop : unhandled GDK_SOURCE type!");
+ break;
+ }
+#endif
}
+
updateTestButtons(key, hotButton);
lastSourceSeen = source;
lastDevnameSeen = devName;