-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcmykuitab.h
144 lines (131 loc) · 3.32 KB
/
cmykuitab.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#ifndef CMYKUITAB_H
#define CMYKUITAB_H
#include <gtk/gtk.h>
#include <gdk/gdkpixbuf.h>
#include "uitab.h"
#include "spinner.h"
#include "conversionopts.h"
#include "debug.h"
#include "ptmutex.h"
#include "cmyktool_core.h"
enum CMYKTabDisplayMode {CMYKDISPLAY_INSPECT,CMYKDISPLAY_PROOF_ADAPT_WHITE,CMYKDISPLAY_PROOF};
// Class to provide a spinner widget that can be shown and hidden.
// Autonomously spins by way of a timeout function, which avoids thread issues.
class TabSpinner : public Spinner
{
public:
TabSpinner() : Spinner(), active(false), shown(false), frame(0)
{
gtk_widget_hide(GetWidget());
}
~TabSpinner()
{
Stop();
while(shown)
{
// Need to wait until it's safe to delete, so pump GTK event loop...
gtk_main_iteration_do(TRUE);
}
}
void Start()
{
active=true;
g_timeout_add(100,timeoutfunc,this);
}
void Stop()
{
active=false;
}
protected:
static gboolean timeoutfunc(gpointer userdata)
{
TabSpinner *s=(TabSpinner *)userdata;
if(!s->shown)
{
gtk_widget_show(s->GetWidget());
s->shown=true;
}
s->frame=(s->frame+1)&7;
s->SetFrame(s->frame);
if(!s->active)
{
gtk_widget_hide(s->GetWidget());
s->shown=false;
}
return(s->active);
}
bool active;
bool shown;
int frame;
};
////// Class to hold view parameters - used for linking tabs with chain button
class CMYKUITab;
class CMYKUITab_View
{
public:
CMYKUITab_View(CMYKUITab *source) : source(source), w(0), h(0), xpan(0), ypan(0), zoom(false), displaymode(CMYKDISPLAY_INSPECT)
{
}
CMYKUITab_View(CMYKUITab *source,int w,int h,int xpan,int ypan,bool zoom, CMYKTabDisplayMode displaymode)
: source(source), w(w),h(h),xpan(xpan),ypan(ypan),zoom(zoom), displaymode(displaymode)
{
}
CMYKUITab_View &operator=(CMYKUITab_View &other)
{
w=other.w;
h=other.h;
xpan=other.xpan;
ypan=other.ypan;
zoom=other.zoom;
displaymode=other.displaymode;
return(*this);
}
CMYKUITab *source;
int w,h;
int xpan,ypan;
bool zoom;
CMYKTabDisplayMode displaymode;
};
class CMYKUITab : public UITab
{
public:
CMYKUITab(GtkWidget *parent,GtkWidget *notebook,CMYKTool_Core &core,const char *filename);
~CMYKUITab();
bool GetLinked();
void SetLinked(bool linked);
void SetImage(const char *filename);
void SetView(CMYKUITab_View &view);
CMYKUITab_View GetView();
void SetDisplayMode(CMYKTabDisplayMode mode);
protected:
static void ColorantsChanged(GtkWidget *wid,gpointer userdata);
static void Save(GtkWidget *widget,gpointer userdata);
static gboolean mousemove(GtkWidget *widget,GdkEventMotion *event, gpointer userdata);
static void LinkToggled(GtkWidget *widget,gpointer userdata);
static void ViewChanged(GtkWidget *widget,gpointer userdata);
static void DisplayModeChanged(GtkWidget *widget,gpointer userdata);
static void MouseMove(GtkWidget *widget,gpointer userdata);
void Redraw();
CMYKTool_Core &core;
GtkWidget *parent;
GtkWidget *hbox;
GtkWidget *colsel;
GtkWidget *pbview;
GtkWidget *displaymode;
GtkWidget *popup;
GtkWidget *linkbutton;
GtkWidget *sumlabel;
bool popupshown;
CachedImage *image;
DeviceNColorantList *collist;
char *filename;
Job *renderjob;
GtkWidget *chain1;
GtkWidget *chain2;
CMYKUITab_View view; // A saved view which is applied when a rendering job finishes
TabSpinner spinner;
friend class UITab_CacheJob;
friend class UITab_RenderJob;
friend class UITab_SaveDialog;
};
#endif