summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-03-31 20:39:34 (GMT)
committerjoye <joye>2014-03-31 20:39:34 (GMT)
commit5032264742e55a7be8cb234208405850846088af (patch)
tree85021f6855b8ce5682a440245a5468724d6b7e47 /src
parentfbce72b1bd39b461d24a4ca43b3be3b6fef75701 (diff)
downloadblt-5032264742e55a7be8cb234208405850846088af.zip
blt-5032264742e55a7be8cb234208405850846088af.tar.gz
blt-5032264742e55a7be8cb234208405850846088af.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElemOption.C4
-rw-r--r--src/bltGrPenOp.C68
-rw-r--r--src/bltGrPenOp.h2
-rw-r--r--src/bltGrPenOption.C94
4 files changed, 97 insertions, 71 deletions
diff --git a/src/bltGrElemOption.C b/src/bltGrElemOption.C
index 931a5b7..c933e66 100644
--- a/src/bltGrElemOption.C
+++ b/src/bltGrElemOption.C
@@ -29,6 +29,7 @@
#include "bltGrElem.h"
#include "bltGrElemOption.h"
+#include "bltGrPenOp.h"
#define ELEM_SOURCE_VALUES 0
#define ELEM_SOURCE_VECTOR 1
@@ -38,9 +39,6 @@
// Defs
-extern int Blt_GetPenFromObj(Tcl_Interp* interp, Graph* graphPtr,
- Tcl_Obj *objPtr, ClassId classId, Pen **penPtrPtr);
-
static void FreeDataValues(ElemValues* valuesPtr);
static void FreeVectorSource(ElemValues* valuesPtr);
static void FindRange(ElemValues* valuesPtr);
diff --git a/src/bltGrPenOp.C b/src/bltGrPenOp.C
index f1740b8..0527923 100644
--- a/src/bltGrPenOp.C
+++ b/src/bltGrPenOp.C
@@ -27,13 +27,7 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#include "bltC.h"
-
extern "C" {
-#include "bltInt.h"
#include "bltGraph.h"
#include "bltOp.h"
};
@@ -45,8 +39,6 @@ extern "C" {
// Defs
-extern int Blt_GetPenFromObj(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr, ClassId classId, Pen **penPtrPtr);
-
static Pen* CreateBarPen(Graph* graphPtr, const char *penName);
static Pen* CreateLinePen(Graph* graphPtr, const char* penName);
static void DestroyPen(Pen* penPtr);
@@ -57,66 +49,6 @@ static int PenObjConfigure(Tcl_Interp* interp, Graph* graphPtr, Pen* penPtr,
typedef int (GraphPenProc)(Tcl_Interp* interp, Graph* graphPtr, int objc,
Tcl_Obj* const objv[]);
-// OptionSpecs
-
-static Tk_CustomOptionSetProc PenSetProc;
-static Tk_CustomOptionGetProc PenGetProc;
-static Tk_CustomOptionFreeProc PenFreeProc;
-Tk_ObjCustomOption barPenObjOption =
- {
- "barPen", PenSetProc, PenGetProc, RestoreProc, PenFreeProc,
- (ClientData)CID_ELEM_BAR
- };
-Tk_ObjCustomOption linePenObjOption =
- {
- "linePen", PenSetProc, PenGetProc, RestoreProc, PenFreeProc,
- (ClientData)CID_ELEM_LINE
- };
-
-static int PenSetProc(ClientData clientData, Tcl_Interp* interp,
- Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec,
- int offset, char* savePtr, int flags)
-{
- Pen** penPtrPtr = (Pen**)(widgRec + offset);
- *(double*)savePtr = *(double*)penPtrPtr;
-
- if (!penPtrPtr)
- return TCL_OK;
-
- const char* string = Tcl_GetString(*objPtr);
- if (!string || !string[0]) {
- *penPtrPtr = NULL;
- return TCL_OK;
- }
-
- Graph* graphPtr = Blt_GetGraphFromWindowData(tkwin);
- ClassId classId = (ClassId)(long(clientData));
- Pen* penPtr;
- if (Blt_GetPenFromObj(interp, graphPtr, *objPtr, classId, &penPtr) != TCL_OK)
- return TCL_ERROR;
-
- *penPtrPtr = penPtr;
-
- return TCL_OK;
-};
-
-static Tcl_Obj* PenGetProc(ClientData clientData, Tk_Window tkwin,
- char *widgRec, int offset)
-{
- Pen* penPtr = *(Pen**)(widgRec + offset);
- if (!penPtr)
- return Tcl_NewStringObj("", -1);
-
- return Tcl_NewStringObj(penPtr->name, -1);
-};
-
-static void PenFreeProc(ClientData clientData, Tk_Window tkwin, char *ptr)
-{
- Pen* penPtr = *(Pen**)ptr;
- if (penPtr)
- Blt_FreePen(penPtr);
-}
-
// Create
int Blt_CreatePen(Graph* graphPtr, Tcl_Interp* interp,
diff --git a/src/bltGrPenOp.h b/src/bltGrPenOp.h
index 18047b7..5b7c495 100644
--- a/src/bltGrPenOp.h
+++ b/src/bltGrPenOp.h
@@ -30,6 +30,8 @@
#ifndef __bltgrpenop_h__
#define __bltgrpenop_h__
+extern int Blt_GetPenFromObj(Tcl_Interp* interp, Graph* graphPtr, Tcl_Obj *objPtr, ClassId classId, Pen **penPtrPtr);
+extern void Blt_DestroyPen(Pen* penPtr);
extern void Blt_FreePen(Pen* penPtr);
#endif
diff --git a/src/bltGrPenOption.C b/src/bltGrPenOption.C
new file mode 100644
index 0000000..ce6c62c
--- /dev/null
+++ b/src/bltGrPenOption.C
@@ -0,0 +1,94 @@
+/*
+ * Smithsonian Astrophysical Observatory, Cambridge, MA, USA
+ * This code has been modified under the terms listed below and is made
+ * available under the same terms.
+ */
+
+/*
+ * Copyright 1996-2004 George A Howlett.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "bltGrPen.h"
+#include "bltGrPenOption.h"
+#include "bltGrPenOp.h"
+
+static Tk_CustomOptionSetProc PenSetProc;
+static Tk_CustomOptionGetProc PenGetProc;
+static Tk_CustomOptionFreeProc PenFreeProc;
+Tk_ObjCustomOption barPenObjOption =
+ {
+ "barPen", PenSetProc, PenGetProc, RestoreProc, PenFreeProc,
+ (ClientData)CID_ELEM_BAR
+ };
+Tk_ObjCustomOption linePenObjOption =
+ {
+ "linePen", PenSetProc, PenGetProc, RestoreProc, PenFreeProc,
+ (ClientData)CID_ELEM_LINE
+ };
+
+static int PenSetProc(ClientData clientData, Tcl_Interp* interp,
+ Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec,
+ int offset, char* savePtr, int flags)
+{
+ Pen** penPtrPtr = (Pen**)(widgRec + offset);
+ *(double*)savePtr = *(double*)penPtrPtr;
+
+ if (!penPtrPtr)
+ return TCL_OK;
+
+ const char* string = Tcl_GetString(*objPtr);
+ if (!string || !string[0]) {
+ *penPtrPtr = NULL;
+ return TCL_OK;
+ }
+
+ Graph* graphPtr = Blt_GetGraphFromWindowData(tkwin);
+ ClassId classId = (ClassId)(long(clientData));
+ Pen* penPtr;
+ if (Blt_GetPenFromObj(interp, graphPtr, *objPtr, classId, &penPtr) != TCL_OK)
+ return TCL_ERROR;
+
+ *penPtrPtr = penPtr;
+
+ return TCL_OK;
+};
+
+static Tcl_Obj* PenGetProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset)
+{
+ Pen* penPtr = *(Pen**)(widgRec + offset);
+ if (!penPtr)
+ return Tcl_NewStringObj("", -1);
+
+ return Tcl_NewStringObj(penPtr->name, -1);
+};
+
+static void PenFreeProc(ClientData clientData, Tk_Window tkwin, char *ptr)
+{
+ Pen* penPtr = *(Pen**)ptr;
+ if (penPtr)
+ Blt_FreePen(penPtr);
+}
+
+// Support
+
+