forked from blackfiveimaging/library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profileuitest.cpp
124 lines (96 loc) · 3.06 KB
/
profileuitest.cpp
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
#include <iostream>
#include "profilemanager.h"
#include <gtk/gtk.h>
#include "profileselector.h"
#include "intentselector.h"
#include "patheditor.h"
#include "imageselector.h"
#include "debug.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gettext.h"
using namespace std;
class Test
{
public:
Test(const char *defprof) : pm(&f,"[Colour Management]"), defprof(defprof)
{}
~Test() {}
void Go()
{
// pm.ClearPaths();
GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(window),8);
gtk_window_set_title (GTK_WINDOW (window), "Profile Manager");
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
(GtkSignalFunc) gtk_main_quit, NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 400,300);
GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox);
ps = profileselector_new(&pm,IS_TYPE_NULL);
g_signal_connect(ps,"changed",G_CALLBACK(profile_changed),this);
gtk_box_pack_start(GTK_BOX(vbox),ps,FALSE,FALSE,8);
gtk_widget_show(ps);
is = intentselector_new(&pm);
g_signal_connect(is,"changed",G_CALLBACK(intent_changed),this);
gtk_box_pack_start(GTK_BOX(vbox),is,FALSE,FALSE,8);
gtk_widget_show(is);
pe = patheditor_new(&pm);
g_signal_connect(pe,"changed",G_CALLBACK(paths_changed),this);
gtk_box_pack_start(GTK_BOX(vbox),pe,TRUE,TRUE,8);
gtk_widget_show(pe);
gtk_widget_show(window);
if(defprof)
profileselector_set_filename(PROFILESELECTOR(ps),defprof);
intentselector_setintent(INTENTSELECTOR(is),LCMSWRAPPER_INTENT_SATURATION);
gtk_main();
}
private:
ConfigFile f;
ProfileManager pm;
GtkWidget *ps;
GtkWidget *is;
GtkWidget *pe;
const char *defprof;
static void profile_changed(GtkWidget *widget,gpointer user_data)
{
cerr << "Received changed signal from ProfileSelector" << endl;
Test *demo=(Test *)user_data;
ProfileSelector *c=PROFILESELECTOR(demo->ps);
const char *val=profileselector_get_filename(c);
if(val)
cerr << "Selected: " << val << endl;
else
cerr << "No profile selected... " << endl;
}
static void intent_changed(GtkWidget *widget,gpointer user_data)
{
cerr << "Received changed signal from IntentSelector" << endl;
Test *demo=(Test *)user_data;
IntentSelector *is=INTENTSELECTOR(demo->is);
int intent=intentselector_getintent(is);
cerr << "Intent " << intent << ": " << demo->pm.GetIntentName(LCMSWrapper_Intent(intent)) << endl;
}
static void paths_changed(GtkWidget *widget,gpointer user_data)
{
cerr << "Received changed signal from PathEditor" << endl;
Test *demo=(Test *)user_data;
patheditor_get_paths(PATHEDITOR(demo->pe),&demo->pm);
cerr << "Updated path list" << endl;
profileselector_refresh(PROFILESELECTOR(demo->ps));
cerr << "Refreshed ProfileManager" << endl;
}
};
int main(int argc, char **argv)
{
Debug.SetLevel(TRACE);
gtk_init(&argc,&argv);
gtk_set_locale();
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
Test demo(argc>1 ? argv[1] : NULL);
demo.Go();
}