annotate plugins/win32/transparency/win2ktrans.c @ 4492:d629e7989a8a

[gaim-migrate @ 4767] Trans back to normal on plugin removal. - Thanks Phrogie committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Fri, 31 Jan 2003 19:42:56 +0000
parents 6c38239ff612
children 7f2de19d052d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * win2ktrans
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
4 * copyright (c) 1998-2002, rob flynn <rob@marko.net>
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
5 *
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
6 * Contributions by Herman Bloggs <hermanator12002@yahoo.com>
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * this program is free software; you can redistribute it and/or modify
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * it under the terms of the gnu general public license as published by
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 * the free software foundation; either version 2 of the license, or
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * (at your option) any later version.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * this program is distributed in the hope that it will be useful,
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * but without any warranty; without even the implied warranty of
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 * merchantability or fitness for a particular purpose. see the
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * gnu general public license for more details.
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * you should have received a copy of the gnu general public license
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 * along with this program; if not, write to the free software
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 * foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21 *
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
22 */
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
23 #define GAIM_PLUGINS
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
24
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
25 #include <gtk/gtk.h>
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
26 #include <gdk/gdkwin32.h>
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include "gaim.h"
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
28 #include "win32dep.h"
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
29
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
30 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
31 * MACROS & DEFINES
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
32 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
33 #define WINTRANS_VERSION 1
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
34
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
35 /* These defines aren't found in mingw's winuser.h */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
36 #ifndef LWA_ALPHA
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
37 #define LWA_ALPHA 0x00000002
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
38 #endif
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
39
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
40 #ifndef WS_EX_LAYERED
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
41 #define WS_EX_LAYERED 0x00080000
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
42 #endif
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
43
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
44 /* Transparency plugin configuration */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
45 #define OPT_WGAIM_IMTRANS 0x00000001
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
46 #define OPT_WGAIM_SHOW_IMTRANS 0x00000002
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
47 #define OPT_WGAIM_BLTRANS 0x00000004
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
48 #define OPT_WGAIM_BUDDYWIN_ONTOP 0x00000008
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
49
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
50 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
51 * GLOBALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
52 */
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
53 G_MODULE_IMPORT GtkWidget *blist;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
54
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
55 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
56 * LOCALS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
57 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
58 static int imalpha = 255;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
59 static int blalpha = 255;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
60 guint trans_options = 0;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
61 GList *window_list = NULL;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
62
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
63 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
64 * PROTOS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
65 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
66 BOOL (*MySetLayeredWindowAttributes)(HWND hwnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags)=NULL;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
67 extern GtkWidget *gaim_button(const char*, guint*, int, GtkWidget*);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
68 static void save_trans_prefs();
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
69
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
70 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
71 * CODE
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
72 */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
73 /* Set window transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
74 void set_wintrans(GtkWidget *window, int trans) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
75 if(MySetLayeredWindowAttributes) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
76 HWND hWnd = GDK_WINDOW_HWND(window->window);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
77 SetWindowLong(hWnd,GWL_EXSTYLE,GetWindowLong(hWnd,GWL_EXSTYLE) | WS_EX_LAYERED);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
78 MySetLayeredWindowAttributes(hWnd,0,trans,LWA_ALPHA);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
79 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
80 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
81
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
82 void set_wintrans_off(GtkWidget *window) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
83 if(MySetLayeredWindowAttributes) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
84 HWND hWnd = GDK_WINDOW_HWND(window->window);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
85 SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
86
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
87 /* Ask the window and its children to repaint */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
88 RedrawWindow(hWnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
89 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
90 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
91
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
92 static void change_alpha(GtkWidget *w, gpointer data) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
93 set_wintrans(GTK_WIDGET(data), gtk_range_get_value(GTK_RANGE(w)));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
94 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
95
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
96 int has_transparency() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
97 return MySetLayeredWindowAttributes ? TRUE : FALSE;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
98 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
99
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
100 GtkWidget *wintrans_slider(GtkWidget *win) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
101 GtkWidget *hbox;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
102 GtkWidget *label, *slider;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
103 GtkWidget *frame;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
104
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
105 frame = gtk_frame_new(NULL);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
106 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
107 gtk_widget_show(frame);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
108
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
109 hbox = gtk_hbox_new(FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
110 gtk_container_add(GTK_CONTAINER(frame), hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
111
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
112 label = gtk_label_new(_("Opacity:"));
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
113 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
114 gtk_widget_show(hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
115
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
116 slider = gtk_hscale_new_with_range(50,255,1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
117 gtk_range_set_value(GTK_RANGE(slider), imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
118 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
119
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
120 /* On slider val change, update window's transparency level */
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
121 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(change_alpha), win);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
122
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
123 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
124
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
125 /* Set the initial transparency level */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
126 set_wintrans(win, imalpha);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
127
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
128 gtk_widget_show_all(hbox);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
129
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
130 return frame;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
131 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
132
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
133 gboolean win_destroy_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
134 /* Remove window from the window list */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
135 debug_printf("win2ktrans.dll: Conv window destoyed.. removing from list\n");
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
136 window_list = g_list_remove(window_list, (gpointer)widget);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
137 return FALSE;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
138 }
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
139
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
140 static void gaim_new_conversation(char *who) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
141 GList *wl, *wl1;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
142 GtkWidget *vbox=NULL;
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
143 GtkWidget *win=NULL;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
144 struct gaim_gtk_window *gaimwin;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
145 struct gaim_conversation *c;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
146
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
147 c = gaim_find_conversation(who);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
148 gaimwin = GAIM_GTK_WINDOW(c->window);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
149 win = gaimwin->window;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
150
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
151 /* check prefs to see if we want trans */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
152 if ((trans_options & OPT_WGAIM_IMTRANS) &&
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
153 (trans_options & OPT_WGAIM_SHOW_IMTRANS)) {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
154 /* Look up this window to see if it already has a scroller */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
155 if(!g_list_find(window_list, (gpointer)win)) {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
156 GtkWidget *slider_box=NULL;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
157
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
158 /* Get top vbox */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
159 for ( wl1 = wl = gtk_container_get_children(GTK_CONTAINER(win));
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
160 wl != NULL;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
161 wl = wl->next ) {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
162 if ( GTK_IS_VBOX(GTK_OBJECT(wl->data)) )
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
163 vbox = GTK_WIDGET(wl->data);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
164 else {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
165 debug_printf("no vbox found\n");
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
166 return;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
167 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
168 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
169 g_list_free(wl1);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
170
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
171 slider_box = wintrans_slider(win);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
172 gtk_box_pack_start(GTK_BOX(vbox),
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
173 slider_box,
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
174 FALSE, FALSE, 0);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
175 /* Add window to list, to track that it has a scroller */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
176 window_list = g_list_append(window_list, (gpointer)win);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
177 /* Set callback to remove window from the list, if the window is destroyed */
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
178 g_signal_connect(GTK_OBJECT(win), "destroy_event", G_CALLBACK(win_destroy_cb), NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
179 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
180 else
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
181 return;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
182 }
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
183
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
184 if((trans_options & OPT_WGAIM_IMTRANS) &&
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
185 !(trans_options & OPT_WGAIM_SHOW_IMTRANS)) {
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
186 set_wintrans(win, imalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
187 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
188 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
189
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
190 static void blist_created() {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
191 if(blist) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
192 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
193 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
194 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
195 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
196
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
197 if(trans_options & OPT_WGAIM_BLTRANS)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
198 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
199 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
200 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
201 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
202 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
203
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
204 static void alpha_change(GtkWidget *w, gpointer data) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
205 int *alpha = (int*)data;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
206 *alpha = gtk_range_get_value(GTK_RANGE(w));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
207 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
208
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
209 static void bl_alpha_change(GtkWidget *w, gpointer data) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
210 alpha_change(w, data);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
211 if(blist)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
212 change_alpha(w, blist);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
213 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
214
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
215 /* Load options */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
216 static void load_trans_prefs() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
217 FILE *f;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
218 char buf[1024];
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
219 int ver=0;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
220 char tag[256];
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
221
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
222 if (gaim_home_dir())
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
223 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "wintransrc", gaim_home_dir());
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
224 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
225 return;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
226
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
227 if ((f = fopen(buf, "r"))) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
228 fgets(buf, sizeof(buf), f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
229 sscanf(buf, "# wintransrc v%d", &ver);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
230 if ((ver > 1) || (buf[0] != '#'))
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
231 return;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
232
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
233 while (!feof(f)) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
234 fgets(buf, sizeof(buf), f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
235 sscanf(buf, "%s {", tag);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
236 if (strcmp(tag, "options")==0) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
237 fgets(buf, sizeof(buf), f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
238 sscanf(buf, "\ttrans_options { %d", &trans_options);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
239 continue;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
240 } else if (strcmp(tag, "trans")==0) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
241 int num;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
242 for(fgets(buf, sizeof(buf), f);buf[0] != '}' && !feof(f);fgets(buf, sizeof(buf), f)) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
243 sscanf(buf, "\t%s { %d", tag, &num);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
244 if(strcmp(tag, "imalpha")==0) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
245 imalpha = num;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
246 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
247 else if(strcmp(tag, "blalpha")==0) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
248 blalpha = num;
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
249 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
250 }
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
251 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
252 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
253 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
254 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
255 save_trans_prefs();
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
256 blist_created();
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
257 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
258
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
259 /* Save options */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
260
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
261 static void write_options(FILE *f) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
262 fprintf(f, "options {\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
263 fprintf(f, "\ttrans_options { %u }\n", trans_options);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
264 fprintf(f, "}\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
265 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
266
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
267 static void write_trans(FILE *f) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
268 fprintf(f, "trans {\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
269 fprintf(f, "\timalpha { %d }\n", imalpha);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
270 fprintf(f, "\tblalpha { %d }\n", blalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
271 fprintf(f, "}\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
272 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
273
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
274 static void save_trans_prefs() {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
275 FILE *f;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
276 char buf[1024];
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
277
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
278 if (gaim_home_dir()) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
279 g_snprintf(buf, sizeof(buf), "%s" G_DIR_SEPARATOR_S ".gaim" G_DIR_SEPARATOR_S "wintransrc", gaim_home_dir());
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
280 }
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
281 else
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
282 return;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
283
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
284 if ((f = fopen(buf, "w"))) {
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
285 fprintf(f, "# wintransrc v%d\n", WINTRANS_VERSION);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
286 write_trans(f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
287 write_options(f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
288 fclose(f);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
289 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
290 else
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
291 debug_printf("Error opening wintransrc\n");
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
292 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
293
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
294 static void set_trans_option(GtkWidget *w, int option) {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
295 trans_options ^= option;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
296 save_trans_prefs();
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
297
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
298 if(option == OPT_WGAIM_BUDDYWIN_ONTOP) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
299 if(blist) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
300 if(trans_options & OPT_WGAIM_BUDDYWIN_ONTOP)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
301 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
302 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
303 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
304 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
305 } else if(option == OPT_WGAIM_BLTRANS) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
306 if(blist) {
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
307 if(trans_options & OPT_WGAIM_BLTRANS)
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
308 set_wintrans(blist, blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
309 else
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
310 set_wintrans_off(blist);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
311 }
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
312 }
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
313 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
314
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
315 /*
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
316 * EXPORTED FUNCTIONS
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
317 */
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
318
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319 G_MODULE_EXPORT char *gaim_plugin_init(GModule *handle) {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320 gaim_signal_connect(handle, event_new_conversation, gaim_new_conversation, NULL);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
321 gaim_signal_connect(handle, event_signon, blist_created, NULL);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
322 MySetLayeredWindowAttributes = (void*)wgaim_find_and_loadproc("user32.dll", "SetLayeredWindowAttributes" );
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
323 load_trans_prefs();
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
324
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
325 return NULL;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
326 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
327
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
328 G_MODULE_EXPORT void gaim_plugin_remove() {
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
329 debug_printf("Removing win2ktrans.dll plugin\n");
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
330 if(window_list) {
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
331 g_list_free(window_list);
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
332 window_list = NULL;
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
333 }
4492
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
334 if(blist) {
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
335 SetWindowPos(GDK_WINDOW_HWND(blist->window), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
336 set_wintrans_off(blist);
d629e7989a8a [gaim-migrate @ 4767]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4400
diff changeset
337 }
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
338 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
340 struct gaim_plugin_description desc;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
341
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
342 G_MODULE_EXPORT struct gaim_plugin_description *gaim_plugin_desc() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
343 desc.api_version = PLUGIN_API_VERSION;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344 desc.name = g_strdup(_("Transparency"));
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
345 desc.version = g_strdup(VERSION);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
346 desc.description = g_strdup(_("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP."));
3831
0d1d4ba2c843 [gaim-migrate @ 3980]
Rob Flynn <gaim@robflynn.com>
parents: 3740
diff changeset
347 desc.authors = g_strdup(_("Rob Flynn &lt;rob@marko.net&gt;"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348 desc.url = g_strdup(WEBSITE);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
349 return &desc;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
350 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
351
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
352 G_MODULE_EXPORT char *name() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
353 return _("Transparency");
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
354 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
355
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
356 G_MODULE_EXPORT char *description() {
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
357 return _("This plugin enables variable alpha transparency on conversation windows.\n\n* Note: This plugin requires Win2000 or WinXP.");
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358 }
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
359
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
360 G_MODULE_EXPORT GtkWidget *gaim_plugin_config_gtk() {
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
361 GtkWidget *ret;
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
362 GtkWidget *imtransbox, *bltransbox;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
363 GtkWidget *hbox;
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
364 GtkWidget *label, *slider;
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
365 GtkWidget *button;
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
366 GtkWidget *trans_box;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
367
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
368 ret = gtk_vbox_new(FALSE, 18);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
369 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
370
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
371 /* IM Convo trans options */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
372 imtransbox = make_frame (ret, _("IM Conversation Windows"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
373 button = gaim_button(_("_IM window transparency"), &trans_options, OPT_WGAIM_IMTRANS, imtransbox);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
374 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_IMTRANS);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
375
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
376 trans_box = gtk_vbox_new(FALSE, 18);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
377 if (!(trans_options & OPT_WGAIM_IMTRANS))
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
378 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
379 gtk_widget_show(trans_box);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
380
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
381 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
382
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
383 button = gaim_button(_("_Show slider bar in IM window"), &trans_options, OPT_WGAIM_SHOW_IMTRANS, trans_box);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
384 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_SHOW_IMTRANS);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
385
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
386 gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
387
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
388 /* IM transparency slider */
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
389 hbox = gtk_hbox_new(FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
390
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
391 label = gtk_label_new(_("Opacity:"));
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
392 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
393
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
394 slider = gtk_hscale_new_with_range(50,255,1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
395 gtk_range_set_value(GTK_RANGE(slider), imalpha);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
396 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
397
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
398 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(alpha_change), (void*)&imalpha);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
399 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL);
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
400
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
401 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
402
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
403 gtk_widget_show_all(hbox);
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
404
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
405 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
406
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
407 /* Buddy List trans options */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
408 bltransbox = make_frame (ret, _("Buddy List Window"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
409 button = gaim_button(_("_Keep Buddy List window on top"), &trans_options, OPT_WGAIM_BUDDYWIN_ONTOP, bltransbox);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
410 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_BUDDYWIN_ONTOP);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
411
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
412 button = gaim_button(_("_Buddy List window transparency"), &trans_options, OPT_WGAIM_BLTRANS, bltransbox);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
413 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_trans_option), (int *)OPT_WGAIM_BLTRANS);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
414
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
415 trans_box = gtk_vbox_new(FALSE, 18);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
416 if (!(trans_options & OPT_WGAIM_BLTRANS))
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
417 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
418 gtk_widget_show(trans_box);
4400
6c38239ff612 [gaim-migrate @ 4669]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4105
diff changeset
419 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gaim_gtk_toggle_sensitive), trans_box);
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
420 gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
421
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
422 /* IM transparency slider */
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
423 hbox = gtk_hbox_new(FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
424
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
425 label = gtk_label_new(_("Opacity:"));
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
426 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
427
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
428 slider = gtk_hscale_new_with_range(50,255,1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
429 gtk_range_set_value(GTK_RANGE(slider), blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
430 gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
431
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
432 gtk_signal_connect(GTK_OBJECT(slider), "value-changed", GTK_SIGNAL_FUNC(bl_alpha_change), (void*)&blalpha);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
433 gtk_signal_connect(GTK_OBJECT(slider), "focus-out-event", GTK_SIGNAL_FUNC(save_trans_prefs), NULL);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
434
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
435 gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
436
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
437 gtk_widget_show_all(hbox);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
438
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
439 gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
440
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
441 /* If this version of Windows dosn't support Transparency, grey out options */
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
442 if(!has_transparency()) {
4105
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
443 debug_printf("This version of windows dosn't support transparency\n");
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
444 gtk_widget_set_sensitive(GTK_WIDGET(imtransbox), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
445 gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
e92d7712b8ba [gaim-migrate @ 4320]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 4096
diff changeset
446 gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE);
4096
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
447 }
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
448
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
449 gtk_widget_show_all(ret);
72d973958607 [gaim-migrate @ 4311]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3831
diff changeset
450 return ret;
3729
a8f0c169e529 [gaim-migrate @ 3867]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
451 }