mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-30 04:05:51 +01:00
Modified ruler stuff
This commit is contained in:
@@ -401,6 +401,23 @@ typedef struct WMInputPanel {
|
|||||||
} WMInputPanel;
|
} WMInputPanel;
|
||||||
|
|
||||||
|
|
||||||
|
/* WMRuler stuff */
|
||||||
|
/* All indentation and tab markers are _relative_ to the left margin marker */
|
||||||
|
|
||||||
|
/* a tabstop is a linked list of tabstops, each containing the position of the tabstop */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int value;
|
||||||
|
struct WMTabStops *next;
|
||||||
|
} WMTabStops;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int left; /* left margin marker */
|
||||||
|
int right; /* right margin marker */
|
||||||
|
int first; /* indentation marker for first line only */
|
||||||
|
int body; /* body indentation marker */
|
||||||
|
WMTabStops *tabs;
|
||||||
|
} WMRulerMargins;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1389,27 +1406,25 @@ int WMGetSplitViewDividerThickness(WMSplitView *sPtr);
|
|||||||
|
|
||||||
/* ...................................................................... */
|
/* ...................................................................... */
|
||||||
|
|
||||||
|
WMRuler *WMCreateRuler (WMWidget *parent);
|
||||||
WMRuler *WMCreateRuler(WMWidget *parent);
|
|
||||||
|
|
||||||
void WMShowRulerTabs(WMRuler *rPtr, Bool Show);
|
void WMShowRulerTabs(WMRuler *rPtr, Bool Show);
|
||||||
|
|
||||||
int WMGetRulerMargin(WMRuler *rPtr, int which);
|
WMRulerMargins WMGetRulerMargins(WMRuler *rPtr);
|
||||||
|
|
||||||
int WMGetReleasedRulerMargin(WMRuler *rPtr);
|
void WMSetRulerMargins(WMRuler *rPtr, WMRulerMargins margins);
|
||||||
|
|
||||||
int WMGetGrabbedRulerMargin(WMRuler *rPtr);
|
int WMGetGrabbedRulerMargin(WMRuler *rPtr);
|
||||||
|
|
||||||
|
int WMGetReleasedRulerMargin(WMRuler *rPtr);
|
||||||
|
|
||||||
int WMGetRulerOffset(WMRuler *rPtr);
|
int WMGetRulerOffset(WMRuler *rPtr);
|
||||||
|
|
||||||
void WMSetRulerOffset(WMRuler *rPtr, int pixels);
|
void WMSetRulerOffset(WMRuler *rPtr, int pixels);
|
||||||
|
|
||||||
void WMSetRulerMargin(WMRuler *rPtr, int which, int pixels);
|
|
||||||
|
|
||||||
void WMSetRulerAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
|
||||||
|
|
||||||
void WMSetRulerMoveAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
void WMSetRulerMoveAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
||||||
|
|
||||||
|
void WMSetRulerReleaseAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
||||||
|
|
||||||
/* ....................................................................... */
|
/* ....................................................................... */
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "wruler.h"
|
#include "WINGsP.h"
|
||||||
|
|
||||||
#define MIN_DOC_WIDTH 10
|
#define MIN_DOC_WIDTH 10
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ typedef struct W_Ruler {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Marker for left margin
|
/* Marker for left margin
|
||||||
|
|
||||||
|\
|
|\
|
||||||
| \
|
| \
|
||||||
|__\
|
|__\
|
||||||
|
|
|
|
||||||
| */
|
| */
|
||||||
static void
|
static void
|
||||||
drawLeftMarker(Ruler *rPtr)
|
drawLeftMarker(Ruler *rPtr)
|
||||||
{
|
{
|
||||||
@@ -58,13 +58,13 @@ drawLeftMarker(Ruler *rPtr)
|
|||||||
rPtr->fg, points, 4, Convex, CoordModeOrigin);
|
rPtr->fg, points, 4, Convex, CoordModeOrigin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Marker for right margin
|
/* Marker for right margin
|
||||||
|
|
||||||
/|
|
/|
|
||||||
/ |
|
/ |
|
||||||
/__|
|
/__|
|
||||||
|
|
|
|
||||||
| */
|
| */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawRightMarker(Ruler *rPtr)
|
drawRightMarker(Ruler *rPtr)
|
||||||
@@ -88,7 +88,7 @@ drawRightMarker(Ruler *rPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Marker for first line only
|
/* Marker for first line only
|
||||||
_____
|
_____
|
||||||
|___|
|
|___|
|
||||||
| */
|
| */
|
||||||
@@ -103,7 +103,7 @@ drawFirstMarker(Ruler *rPtr)
|
|||||||
rPtr->fg, xpos, 12, xpos, 22);
|
rPtr->fg, xpos, 12, xpos, 22);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Marker for rest of body
|
/* Marker for rest of body
|
||||||
_____
|
_____
|
||||||
\ /
|
\ /
|
||||||
\./ */
|
\./ */
|
||||||
@@ -142,20 +142,20 @@ drawRulerOnPixmap(Ruler *rPtr)
|
|||||||
char c[3];
|
char c[3];
|
||||||
int marks[9] = {11, 3, 5, 3, 7, 3, 5, 3};
|
int marks[9] = {11, 3, 5, 3, 7, 3, 5, 3};
|
||||||
|
|
||||||
if(!rPtr->drawBuffer)
|
if(!rPtr->drawBuffer)
|
||||||
createDrawBuffer(rPtr);
|
createDrawBuffer(rPtr);
|
||||||
|
|
||||||
XFillRectangle(rPtr->view->screen->display, rPtr->drawBuffer,
|
XFillRectangle(rPtr->view->screen->display, rPtr->drawBuffer,
|
||||||
rPtr->bg, 0, 0, rPtr->view->size.width, 40);
|
rPtr->bg, 0, 0, rPtr->view->size.width, 40);
|
||||||
|
|
||||||
|
|
||||||
WMDrawString(rPtr->view->screen, rPtr->drawBuffer,
|
WMDrawString(rPtr->view->screen, rPtr->drawBuffer,
|
||||||
rPtr->fg, rPtr->font, rPtr->margins.left+2, 26, "0 inches", 10);
|
rPtr->fg, rPtr->font, rPtr->margins.left+2, 26, "0 inches", 10);
|
||||||
|
|
||||||
/* marker ticks */
|
/* marker ticks */
|
||||||
i=j=m=0;
|
i=j=m=0;
|
||||||
w = rPtr->view->size.width - rPtr->margins.left;
|
w = rPtr->view->size.width - rPtr->margins.left;
|
||||||
while(m < w) {
|
while(m < w) {
|
||||||
XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,
|
XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,
|
||||||
rPtr->fg, rPtr->margins.left+m, 23,
|
rPtr->fg, rPtr->margins.left+m, 23,
|
||||||
rPtr->margins.left+m, marks[i%8]+23);
|
rPtr->margins.left+m, marks[i%8]+23);
|
||||||
@@ -168,19 +168,19 @@ drawRulerOnPixmap(Ruler *rPtr)
|
|||||||
rPtr->fg, rPtr->font, rPtr->margins.left+2+m, 26, c, 2);
|
rPtr->fg, rPtr->font, rPtr->margins.left+2+m, 26, c, 2);
|
||||||
}
|
}
|
||||||
m = (++i)*10;
|
m = (++i)*10;
|
||||||
}
|
}
|
||||||
|
|
||||||
rPtr->end = rPtr->margins.left+m-10;
|
rPtr->end = rPtr->margins.left+m-10;
|
||||||
if(rPtr->margins.right > rPtr->end)
|
if(rPtr->margins.right > rPtr->end)
|
||||||
rPtr->margins.right = rPtr->end;
|
rPtr->margins.right = rPtr->end;
|
||||||
/* base line */
|
/* base line */
|
||||||
XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,
|
XDrawLine(rPtr->view->screen->display, rPtr->drawBuffer,
|
||||||
rPtr->fg, rPtr->margins.left, 22, rPtr->margins.left+m-10, 22);
|
rPtr->fg, rPtr->margins.left, 22, rPtr->margins.left+m-10, 22);
|
||||||
|
|
||||||
drawLeftMarker(rPtr);
|
drawLeftMarker(rPtr);
|
||||||
drawRightMarker(rPtr);
|
drawRightMarker(rPtr);
|
||||||
drawFirstMarker(rPtr);
|
drawFirstMarker(rPtr);
|
||||||
drawBodyMarker(rPtr);
|
drawBodyMarker(rPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
|
|
||||||
#include <WINGs.h>
|
|
||||||
#include <WINGsP.h>
|
|
||||||
#include <WUtil.h>
|
|
||||||
|
|
||||||
//items in this file go into WINGs.h
|
|
||||||
#define WC_Ruler 16
|
|
||||||
typedef struct W_Ruler WMRuler;
|
|
||||||
|
|
||||||
/* All indentation and tab markers are _relative_ to the left margin marker */
|
|
||||||
|
|
||||||
/* a tabstop is a linked list of tabstops,
|
|
||||||
* each containing the position of the tabstop */
|
|
||||||
|
|
||||||
typedef struct _tabstops {
|
|
||||||
struct _tabstops *next;
|
|
||||||
int value;
|
|
||||||
} WMTabStops;
|
|
||||||
|
|
||||||
typedef struct W_RulerMargins {
|
|
||||||
int left; /* left margin marker */
|
|
||||||
int right; /* right margin marker */
|
|
||||||
int first; /* indentation marker for first line only */
|
|
||||||
int body; /* body indentation marker */
|
|
||||||
WMTabStops *tabs;
|
|
||||||
} WMRulerMargins;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WMRuler *WMCreateRuler (WMWidget *parent);
|
|
||||||
void WMShowRulerTabs(WMRuler *rPtr, Bool Show);
|
|
||||||
void WMSetRulerMoveAction(WMRuler *rPtr,
|
|
||||||
WMAction *action, void *clientData);
|
|
||||||
void WMSetRulerReleaseAction(WMRuler *rPtr,
|
|
||||||
WMAction *action, void *clientData);
|
|
||||||
|
|
||||||
int WMGetRulerOffset(WMRuler *rPtr);
|
|
||||||
void WMSetRulerOffset(WMRuler *rPtr, int pixels);
|
|
||||||
|
|
||||||
WMRulerMargins WMGetRulerMargins(WMRuler *rPtr);
|
|
||||||
void WMSetRulerMargins(WMRuler *rPtr, WMRulerMargins margins);
|
|
||||||
|
|
||||||
int WMGetReleasedRulerMargin(WMRuler *rPtr);
|
|
||||||
int WMGetGrabbedRulerMargin(WMRuler *rPtr);
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user