annotate src/gui_kde_x11.cc @ 11:4424b47a0797

updated for version 7.0003
author vimboss
date Wed, 30 Jun 2004 16:16:41 +0000
parents
children 3ba373b54370
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
2 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
4 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
7 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
8
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
9 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
10 * Porting to KDE(2) was done by
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
11 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
12 * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
13 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
14 * Please visit http://freehackers.org/kvim for other vim- or
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
15 * kde-related coding.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
16 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
17 * $Id$
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
18 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
19 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
20
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
21 #include <qscrollbar.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
22 #include <qcstring.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
23 #include <qdatetime.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
24 #include <qcursor.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
25 #include <qfontmetrics.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
26 #include <qpaintdevice.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
27 #include <qclipboard.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
28 #include <qregexp.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
29 #include <kaboutkde.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
30 #include <kiconloader.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
31 #include <kfontdialog.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
32 #include <kmessagebox.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
33 #include <dcopclient.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
34 #include <kwin.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
35 #include <kmenubar.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
36 #include <kconfig.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
37 #if (QT_VERSION>=300)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
38 #include <qnamespace.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
39 #include <ktip.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
40 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
41 #include <qpopupmenu.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
42 #include <qpainter.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
43 #include <qtextcodec.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
44 #include <qfontmetrics.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
45 #include <qfont.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
46
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
47
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
48 #include "gui_kde_widget.h"
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
49
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
50
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
51 extern "C" {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
52 #include "vim.h"
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
53 #include "version.h"
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
54 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
55
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
56 #include <stdio.h>
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
57
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
58 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
59 * global variable for KDE, we can't put them in Gui, cause there are C++ types
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
60 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
61 VimMainWindow *vmw=0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
62 SBPool *sbpool=0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
63 QString *argServerName=0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
64
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
65 #ifdef FEAT_MOUSESHAPE
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
66 /* The last set mouse pointer shape is remembered, to be used when it goes
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
67 * from hidden to not hidden. */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
68 static int last_shape = 0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
69 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
70
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
71 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
72 * Arguments handled by KDE internally.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
73 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
74
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
75 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
76 static int tip=0; // 1 no dialog, 0 use it if enabled in conf, 2 force the tip
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
77 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
78 static int reverse=0; // 0 bg : white, 1 : bg : black
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
79 QString *startfont;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
80 QSize *startsize;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
81 static int gui_argc = 0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
82 static char **gui_argv = NULL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
83
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
84 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
85 * Parse the GUI related command-line arguments. Any arguments used are
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
86 * deleted from argv, and *argc is decremented accordingly. This is called
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
87 * when vim is started, whether or not the GUI has been started.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
88 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
89 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
90 gui_mch_prepare(int *argc, char **argv)// {{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
91 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
92 //copy args for KDE/Qt
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
93 gui_argc = 0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
94 //this one is not really good as all options are not for KDE/Qt ...
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
95 gui_argv = (char **)lalloc((long_u)(*argc * sizeof(char *)), FALSE);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
96 if (gui_argv == NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
97 return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
98 gui_argv[gui_argc++] = argv[0];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
99
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
100 int found = 0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
101 for (int i = 1; i < *argc ; i++)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
102 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
103 if (found!=2)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
104 found = 0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
105 else {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
106 found=0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
107 //remove from the list of argv
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
108 if (--*argc>i) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
109 mch_memmove(&argv[i], &argv[i + 1],
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
110 (*argc - i) * sizeof(char *));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
111 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
112 i--;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
113 continue;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
114 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
115
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
116 if (strcmp(argv[i],"--servername")==0) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
117 argServerName = new QString(argv[i+1]); // to get the serverName now
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
118 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
119 #if QT_VERSION>+300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
120 if (strcmp(argv[i],"-tip")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
121 tip=2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
122 found=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
123 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
124 if (strcmp(argv[i],"-notip")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
125 tip=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
126 found=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
127 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
128 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
129 if (strcmp(argv[i],"-black")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
130 reverse=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
131 found=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
132 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
133 /* replaced by -black */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
134 /* if (strcmp(argv[i],"-rv")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
135 reverse=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
136 found=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
137 }*/
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
138 if (strcmp(argv[i],"-font")==0 || strcmp(argv[i], "-fn")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
139 startfont=new QString(argv[i+1]);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
140 found=2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
141 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
142 if (strcmp(argv[i],"-geometry")==0 || strcmp (argv[i],"-geom")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
143 found=2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
144 QString text(argv[i+1]);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
145 QStringList list = QStringList::split(QChar('x'), text);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
146 startsize = new QSize(list[0].toInt(),list[1].toInt());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
147 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
148 if (strcmp (argv[i],"-display")==0 ) { //XXX: this does not work,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
149 // too many -display options in main.c !
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
150 // ask Bram ...
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
151 gui_argv[gui_argc++] = strdup("--display");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
152 gui_argv[gui_argc++] = argv[i+1];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
153 found=0;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
154 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
155 if (strcmp (argv[i],"--display")==0 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
156 gui_argv[gui_argc++] = argv[i];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
157 gui_argv[gui_argc++] = argv[i+1];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
158 found=2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
159 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
160 //KDE/Qt options with no args
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
161 if (strcmp(argv[i],"--help-kde")==0 || strcmp (argv[i],"--help-qt")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
162 || strcmp(argv[i], "--help-all")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
163 || strcmp(argv[i], "--reverse")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
164 || strcmp(argv[i], "--author")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
165 // || strcmp(argv[i], "--version")==0 //disabled we need these for kcmvim
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
166 // || strcmp(argv[i], "-v")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
167 || strcmp(argv[i], "--license")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
168 || strcmp(argv[i], "--cmap")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
169 || strcmp(argv[i], "--nograb")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
170 || strcmp(argv[i], "--dograb")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
171 || strcmp(argv[i], "--sync")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
172 || strcmp(argv[i], "--noxim")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
173 || strcmp(argv[i], "--nocrashhandler")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
174 || strcmp(argv[i], "--waitforwm")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
175 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
176 gui_argv[gui_argc++] = argv[i];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
177 found=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
178 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
179 //this outputs KDE and Vim versions :)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
180 if (strcmp(argv[i],"--version")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
181 || strcmp (argv[i],"-v")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
182 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
183 gui_argv[gui_argc++] = argv[i];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
184 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
185
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
186
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
187 //KDE/Qt options with one arg
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
188 if ( strcmp(argv[i],"--session")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
189 || strcmp(argv[i],"--ncols")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
190 || strcmp(argv[i],"--bg")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
191 || strcmp(argv[i],"--background")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
192 || strcmp(argv[i],"--fg")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
193 || strcmp(argv[i],"--foreground")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
194 || strcmp(argv[i],"--btn")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
195 || strcmp(argv[i],"--name")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
196 || strcmp(argv[i],"--title")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
197 || strcmp(argv[i],"--inputstyle")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
198 || strcmp(argv[i],"--im")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
199 || strcmp(argv[i],"--caption")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
200 || strcmp(argv[i],"--icon")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
201 || strcmp(argv[i],"--miniicon")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
202 || strcmp(argv[i],"--config")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
203 || strcmp(argv[i],"--dcopserver")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
204 || strcmp(argv[i],"--style")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
205 || strcmp(argv[i],"--geometry")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
206 || strcmp(argv[i],"--smkey")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
207 || strcmp(argv[i],"-smkey")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
208 || strcmp(argv[i],"-session")==0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
209 ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
210 gui_argv[gui_argc++] = argv[i];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
211 gui_argv[gui_argc++] = argv[i+1];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
212 found=2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
213 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
214
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
215 //remove from the list of argv
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
216 if (found >= 1 && --*argc>i) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
217 mch_memmove(&argv[i], &argv[i + 1],
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
218 (*argc - i) * sizeof(char *));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
219 i--;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
220 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
221 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
222 KCmdLineArgs::init( gui_argc,gui_argv,"kvim", I18N_NOOP("Vim inside KDE"),VIM_VERSION_SHORT);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
223 }// }}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
224
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
225 /****************************************************************************
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
226 * Focus handlers:
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
227 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
228
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
229 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
230 * Initialises time intervals for the cursor blinking
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
231 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
232 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
233 gui_mch_set_blinking(long waittime, long on, long off)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
234 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
235 gui.w->set_blink_time( waittime, on, off );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
236 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
237
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
238 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
239 * Stop the cursor blinking. Show the cursor if it wasn't shown.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
240 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
241 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
242 gui_mch_stop_blink()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
243 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
244 gui.w->stop_cursor_blinking();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
245 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
246
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
247 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
248 * Start the cursor blinking. If it was already blinking, this restarts the
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
249 * waiting time and shows the cursor.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
250 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
251 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
252 gui_mch_start_blink()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
253 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
254 gui.w->start_cursor_blinking();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
255 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
256
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
257 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
258 * Check if the GUI can be started. Called before gvimrc is sourced.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
259 * Return OK or FAIL.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
260 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
261 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
262 gui_mch_init_check(void)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
263 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
264 gui.dpy = qt_xdisplay();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
265 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
266 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
267
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
268 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
269 * Initialise the X GUI. Create all the windows, set up all the call-backs etc.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
270 * Returns OK for success, FAIL when the GUI can't be started.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
271 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
272 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
273 gui_mch_init()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
274 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
275 (void) new KApplication();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
276 KApplication::kApplication()->dcopClient()->registerAs(KApplication::kApplication()->name(),false);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
277 // dbf("%s %s",KGlobal::locale()->language().latin1(),KLocale::defaultLanguage().latin1());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
278
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
279 vmw = new VimMainWindow("KVim",0);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
280 vmw->setFrameBorderWidth(0);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
281 kapp->setMainWidget(vmw);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
282 kapp->setTopWidget(vmw);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
283
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
284 sbpool = new SBPool;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
285
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
286 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
287 vmw->connect(kapp->clipboard(),SIGNAL(selectionChanged()),vmw,SLOT(clipboard_selection_update()));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
288 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
289 vmw->connect(kapp->clipboard(),SIGNAL(dataChanged()),vmw,SLOT(clipboard_data_update()));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
290 clip_lose_selection(&clip_plus);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
291 clip_lose_selection(&clip_star);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
292
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
293 gui.in_focus = FALSE; // will be updated
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
294
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
295 if (reverse) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
296 gui.def_norm_pixel = gui_get_color((char_u *)"White");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
297 gui.def_back_pixel = gui_get_color((char_u *)"Black");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
298 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
299 gui.w->setEraseColor ( QColor(Qt::black) );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
300 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
301 gui.w->setBackgroundColor ( QColor(Qt::black) );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
302 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
303 } else {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
304 gui.def_norm_pixel = gui_get_color((char_u *)"Black");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
305 gui.def_back_pixel = gui_get_color((char_u *)"White");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
306 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
307 gui.w->setEraseColor ( QColor(Qt::white) );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
308 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
309 gui.w->setBackgroundColor ( QColor(Qt::white) );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
310 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
311 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
312
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
313 gui.norm_pixel = gui.def_norm_pixel;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
314 gui.back_pixel = gui.def_back_pixel;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
315
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
316 gui.border_width = 1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
317 gui.border_offset = 1;//gui.border_width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
318 gui.scrollbar_width=SB_DEFAULT_WIDTH;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
319 gui.scrollbar_height=SB_DEFAULT_WIDTH;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
320
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
321 //gui.menu_height=vmw->menuBar()->height()+1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
322 //gui.toolbar_height=vmw->toolBar()->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
323
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
324 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
325 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
326
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
327
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
328 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
329 * Called when the foreground or background color has been changed.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
330 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
331 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
332 gui_mch_new_colors()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
333 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
334 QColor rgb;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
335 rgb.setRgb(gui.back_pixel);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
336 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
337 gui.w->setEraseColor(rgb);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
338 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
339 gui.w->setBackgroundColor(rgb);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
340 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
341 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
342
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
343 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
344 * Open the GUI window which was created by a call to gui_mch_init().
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
345 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
346 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
347 gui_mch_open()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
348 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
349 gui.dpy=qt_xdisplay();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
350 set_normal_colors();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
351
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
352 /* Check that none of the colors are the same as the background color */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
353 gui_check_colors();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
354
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
355 /* Get the colors for the highlight groups (gui_check_colors() might have
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
356 * changed them).
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
357 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
358 highlight_gui_started(); /* re-init colors and fonts */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
359 #ifdef FEAT_MENU
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
360 vmw->w->menu = new QPopupMenu(vmw);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
361
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
362 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
363 vmw->w->menu->insertItem(SmallIcon("ktip"), i18n("&Tip of the day..."), vmw, SLOT(showTipOfTheDay()));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
364 vmw->w->menu->insertSeparator();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
365 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
366 if (vmw->have_tearoff) vmw->w->menu->insertTearOffHandle(0,0);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
367 vmw->w->menu->insertItem(i18n("&Report Bug ..."), vmw, SLOT(showBugReport()));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
368 vmw->w->menu->insertSeparator();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
369 vmw->w->menu->insertItem(SmallIcon("kvim"), i18n("&About KVim..."), vmw, SLOT(showAboutApplication()));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
370 vmw->w->menu->insertItem(SmallIcon("about_kde"), i18n("About &KDE..."), vmw, SLOT(showAboutKDE()));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
371 vmw->menuBar()->insertItem("&KVim", vmw->w->menu);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
372 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
373 if (startfont!=NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
374 gui_mch_init_font((char_u*)startfont->latin1(),0);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
375
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
376 if (startsize!=NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
377 vmw->resize(startsize->width(), startsize->height());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
378
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
379 gui_mch_update_codec();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
380
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
381 if (kapp->isRestored())
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
382 if (KMainWindow::canBeRestored(1))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
383 vmw->restore(1);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
384
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
385 vmw->show();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
386 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
387 if (tip==2) KTipDialog::showTip (vmw,QString::null,true);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
388 else if (tip==0) KTipDialog::showTip (vmw);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
389 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
390
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
391 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
392 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
393
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
394 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
395 gui_mch_exit(int rc)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
396 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
397 kapp->quit();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
398 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
399
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
400 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
401 * Get the position of the top left corner of the window.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
402 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
403 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
404 gui_mch_get_winpos(int *x, int *y)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
405 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
406 *x = vmw->x();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
407 *y = vmw->y();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
408 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
409 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
410
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
411 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
412 * Set the position of the top left corner of the window to the given
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
413 * coordinates.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
414 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
415 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
416 gui_mch_set_winpos(int x, int y)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
417 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
418 vmw->move(x,y);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
419 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
420
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
421 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
422 * Set the windows size.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
423 * ->resize VimWidget
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
424 * ->resize vmw (block any events generated from here)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
425 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
426 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
427 gui_mch_set_shellsize(int width, int height,//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
428 int min_width, int min_height,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
429 int base_width, int base_height)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
430 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
431 //resize VimWidget
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
432 vmw->w->resize(width,height);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
433
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
434 //resize vmw
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
435 int vheight, vwidth;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
436 vheight = height;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
437 vwidth = width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
438
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
439 if (gui.which_scrollbars[SBAR_LEFT]) vwidth+=gui.scrollbar_width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
440 if (gui.which_scrollbars[SBAR_RIGHT]) vwidth+=gui.scrollbar_width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
441 if (gui.which_scrollbars[SBAR_BOTTOM]) vheight+=gui.scrollbar_height;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
442
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
443 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
444 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
445 && !vmw->menuBar()->isTopLevelMenu()
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
446 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
447 )
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
448 vheight += vmw->menuBar()->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
449 #ifdef FEAT_TOOLBAR
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
450 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
451 (vmw->toolBar()->barPos()==KToolBar::Top ||
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
452 vmw->toolBar()->barPos()==KToolBar::Bottom))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
453 vheight += vmw->toolBar()->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
454
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
455 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
456 (vmw->toolBar()->barPos()==KToolBar::Left ||
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
457 vmw->toolBar()->barPos()==KToolBar::Right))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
458 vwidth += vmw->toolBar()->width();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
459 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
460 vmw->lock();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
461 vmw->resize(vwidth,vheight);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
462 gui_mch_update();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
463 //size should be nearly perfect, update baseSize and sizeIncrement
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
464 vmw->setBaseSize(base_width,vmw->menuBar()->height()+1+vmw->toolBar()->height()+gui.char_height*2);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
465 vmw->setSizeIncrement( ( ( int )( gui.char_width/2 )*2 ),gui.char_height);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
466 vmw->unlock();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
467 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
468
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
469
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
470 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
471 * The screen size is used to make sure the initial window doesn't get bigger
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
472 * then the screen. This subtracts some room for menubar, toolbar and window
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
473 * decorations.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
474 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
475 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
476 gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
477 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
478 *screen_w = kapp->desktop()->width();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
479 *screen_h = kapp->desktop()->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
480 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
481
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
482 #if defined(FEAT_MENU) || defined(PROTO)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
483 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
484 gui_mch_enable_menu(int showit)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
485 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
486 if (showit)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
487 vmw->menuBar()->show();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
488 else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
489 vmw->menuBar()->hide();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
490 vmw->resize(vmw->width(),vmw->height());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
491 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
492 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
493
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
494
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
495 #if defined(FEAT_TOOLBAR) || defined(PROTO)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
496 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
497 gui_mch_show_toolbar(int showit)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
498 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
499 if (showit)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
500 vmw->toolBar()->show();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
501 else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
502 vmw->toolBar()->hide();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
503 vmw->resize(vmw->width(),vmw->height());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
504 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
505 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
506
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
507 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
508 * Put up a font dialog and return the selected font name in allocated memory.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
509 * "oldval" is the previous value.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
510 * Return NULL when cancelled.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
511 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
512
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
513 char_u *gui_mch_font_dialog (char_u *oldval)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
514 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
515 QFont myFont( vmw->w->font() );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
516 if (gui.fontname) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
517 gui.fontname=NULL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
518 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
519 int result = KFontDialog::getFont( myFont, true );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
520 if ( result != KFontDialog::Accepted ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
521 return NULL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
522 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
523 // myFont.setFixedPitch(true);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
524 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
525 QString n = myFont.toString();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
526 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
527 QString n = KVimUtils::toString(&myFont);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
528 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
529 n.replace(QRegExp(","),"/");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
530 gui.fontname = (char_u *)strdup((const char *)n);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
531 n.replace(QRegExp(" "),"\\ ");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
532 n=QString("To set this font as your default font for KVim, edit your ~/.gvimrc file and add the following lines : \nif has(\"gui_kde\")\nset guifont=")+n+QString("\nendif");// \n OR \n use the control center of KDE and choose the correct fixed font");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
533
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
534 //display a message box which explains how to save your font settings
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
535 KMessageBox::information(vmw, n,"Font Selection", "kvimselectfont");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
536
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
537 return vim_strsave(gui.fontname);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
538 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
539
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
540 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
541 * Initialise vim to use the font with the given name.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
542 * Return FAIL if the font could not be loaded, OK otherwise.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
543 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
544 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
545 gui_mch_init_font(char_u * font_name, int fontset)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
546 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
547 QString fontname;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
548 GuiFont font=NULL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
549
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
550 if (font_name==NULL) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
551 #if 0
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
552 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
553 KConfig *base = KGlobal::config();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
554 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
555 KConfigBase *base = KGlobal::config();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
556 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
557 base->setGroup("General");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
558 if(!base->hasKey("fixed")) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
559 KMessageBox::error(KApplication::kApplication()->mainWidget(),"Cannot load default fixed font\n\nConfigure fonts in KDE Control Center.\n(Just click 'Choose...', 'OK' and then 'Apply')");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
560 return FAIL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
561 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
562 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
563 QString f = base->readEntry("fixed");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
564 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
565 QFont ft = base->readFontEntry("fixed", NULL);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
566 QString f = KVimUtils::toString(&ft);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
567 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
568 font_name = (char_u*)strdup(f.latin1()); //latin1 ?
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
569 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
570 font_name = (char_u*)strdup("misc-fixed/10/-1/5/50/0/0/0/1/0");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
571 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
572 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
573 fontname = (const char *)font_name;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
574 /* fontname.replace(QRegExp("/"),",");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
575 font = new QFont();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
576 font->fromString( fontname );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
577 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
578 gui_mch_free_font(gui.norm_font);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
579 #ifdef FEAT_XFONTSET
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
580 gui_mch_free_fontset(gui.fontset);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
581 if (fontset)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
582 font = gui_mch_get_fontset(font_name,TRUE,TRUE);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
583 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
584 if (font == NULL) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
585 font = gui_mch_get_font(font_name,FALSE);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
586 gui.norm_font = font;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
587 #ifdef FEAT_XFONTSET
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
588 gui.fontset=NOFONTSET;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
589 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
590 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
591 #ifdef FEAT_XFONTSET
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
592 else {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
593 gui.fontset=font;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
594 gui.norm_font=NOFONT;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
595 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
596 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
597
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
598 if (font == NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
599 return FAIL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
600
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
601 if (fontname.contains('*') && fontname.contains('-'))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
602 return FAIL;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
603
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
604 QFontMetrics f(*font);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
605 gui.char_width = f.maxWidth();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
606 gui.char_height = f.height()+p_linespace;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
607 gui.char_ascent = f.ascent()+p_linespace/2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
608
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
609 //check values, just to make sure and avoid a crash
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
610 if (gui.char_width<=0) gui.char_width=8;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
611 if (gui.char_height<=0) gui.char_height=1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
612
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
613 hl_set_font_name(font_name);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
614
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
615 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
616 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
617
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
618 GuiFont
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
619 gui_mch_get_font(char_u * name, int report_error)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
620 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
621 QString fontname((const char *)name);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
622 if (!gui.in_use || name == NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
623 return NOFONT;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
624 if (fontname.contains('*') && fontname.contains('-'))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
625 return NOFONT; // XFLD names not allowed anymore
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
626 QFont *myFont = new QFont();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
627 fontname.replace(QRegExp("/"),",");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
628 // myFont->setRawMode(TRUE);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
629
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
630 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
631 myFont->fromString(fontname);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
632 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
633 KVimUtils::fromString(myFont,fontname);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
634 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
635 myFont->setFixedPitch(true);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
636 if (!myFont->fixedPitch()) dbf("Non fixed-width font");
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
637 return (GuiFont) myFont;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
638 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
639
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
640 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
641 * Set the current text font.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
642 * Since we create all GC on demand, we use just gui.current_font to
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
643 * indicate the desired current font.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
644 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
645 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
646 gui_mch_set_font(GuiFont font)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
647 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
648 gui.current_font=font;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
649 gui.w->painter->setFont( *(gui.current_font) );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
650 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
651
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
652 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
653 * If a font is not going to be used, free its structure.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
654 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
655 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
656 gui_mch_free_font(GuiFont font)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
657 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
658 if (font)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
659 delete font; // this is a QFont , we can delete it :)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
660 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
661
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
662 GuiFontset gui_mch_get_fontset (char_u *name, int report_error, int fixed_width)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
663 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
664 return (GuiFontset)gui_mch_get_font(name,report_error);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
665 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
666
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
667 void gui_mch_set_fontset (GuiFontset fontset)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
668 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
669 gui_mch_set_font((GuiFont)fontset);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
670 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
671
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
672 void gui_mch_free_fontset (GuiFontset fontset)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
673 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
674 if (fontset)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
675 delete fontset;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
676 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
677
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
678 void gui_mch_settitle (char_u *title, char_u *icon)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
679 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
680 if (!gui.in_use) /* can't do this when GUI not running */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
681 return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
682 vmw->setPlainCaption((const char *)title);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
683 QPixmap p((const char *)icon);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
684 vmw->setIcon(p); //FIXME
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
685 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
686
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
687 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
688 * Return the Pixel value (color) for the given color name. This routine was
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
689 * pretty much taken from example code in the Silicon Graphics OSF/Motif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
690 * Programmer's Guide.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
691 * Return -1 for error.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
692 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
693 guicolor_T
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
694 gui_mch_get_color(char_u * name)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
695 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
696 int i;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
697 static char *(vimnames[][2]) =
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
698 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
699 /* A number of colors that some X11 systems don't have */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
700 {"LightRed", "#FFA0A0"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
701 {"LightGreen", "#80FF80"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
702 {"LightMagenta", "#FFA0FF"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
703 {"DarkCyan", "#008080"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
704 {"DarkBlue", "#0000C0"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
705 {"DarkRed", "#C00000"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
706 {"DarkMagenta", "#C000C0"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
707 {"DarkGrey", "#C0C0C0"},
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
708 {NULL, NULL}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
709 };
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
710
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
711 if (!gui.in_use) /* can't do this when GUI not running */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
712 return (guicolor_T)(-1);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
713
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
714 QColor _color((const char *)name);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
715
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
716
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
717 if (_color.isValid()) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
718 //return (_color.red() << 16) + ((_color.green() << 8)) + (_color.blue());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
719 return _color.rgb();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
720 //return (guicolor_T) _color.pixel();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
721 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
722
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
723 /* add a few builtin names */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
724 for (i = 0;; ++i) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
725 if (vimnames[i][0] == NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
726 return (guicolor_T)(-1);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
727 if (STRICMP(name, vimnames[i][0]) == 0) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
728 name = (char_u *) vimnames[i][1];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
729 return gui_mch_get_color(name);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
730 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
731 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
732
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
733 return (guicolor_T)(-1); // dead code, should not be reached..
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
734 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
735
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
736 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
737 * Set the current text foreground color.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
738 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
739 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
740 gui_mch_set_fg_color(guicolor_T color)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
741 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
742 QColor rgb;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
743 rgb.setRgb(color);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
744 gui.w->painter->setPen( rgb );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
745 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
746
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
747 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
748 * Set the current text background color.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
749 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
750 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
751 gui_mch_set_bg_color(guicolor_T color)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
752 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
753 QColor rgb;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
754 rgb.setRgb(color);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
755 gui.w->painter->setBackgroundColor(rgb);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
756 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
757
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
758 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
759 * Use the blank mouse pointer or not.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
760 *
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
761 * hide: TRUE = use blank ptr, FALSE = use parent ptr
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
762 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
763 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
764 gui_mch_mousehide(int hide)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
765 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
766 if (hide == gui.pointer_hidden) return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
767 //#ifdef FEAT_MOUSESHAPE
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
768 // if( !hide) mch_set_mouse_shape(last_shape);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
769 //#else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
770 # if (QT_VERSION<300)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
771 gui.w->setCursor((hide)?BlankCursor:ArrowCursor);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
772 # else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
773 gui.w->setCursor((hide)?Qt::BlankCursor:Qt::ArrowCursor);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
774 # endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
775 //#endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
776 gui.pointer_hidden = hide;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
777 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
778
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
779 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
780 gui_mch_update_codec()
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
781 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
782 #ifdef FEAT_MBYTE
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
783 if (!gui.in_use) return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
784 vmw->codec = QTextCodec::codecForName((const char *)p_enc);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
785 if (vmw->codec==NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
786 vmw->codec = QTextCodec::codecForName(KVimUtils::convertEncodingName(QString((const char*)p_enc)));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
787 if (vmw->codec==NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
788 vmw->codec = QTextCodec::codecForLocale();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
789 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
790 vmw->codec = QTextCodec::codecForLocale();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
791 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
792 if (vmw->codec==NULL)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
793 vmw->codec = QTextCodec::codecForName("ISO-8859-1"); //fallback
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
794 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
795
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
796 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
797 gui_mch_draw_string(int row, int col, char_u * s, int len, int flags)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
798 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
799 QString text = vmw->codec->toUnicode((const char *)s,len);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
800 gui.w->draw_string( TEXT_X(col), TEXT_Y(row), text, text.length(), flags );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
801 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
802
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
803 #if defined(FEAT_TITLE) || defined(PROTO)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
804 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
805 * Return the text window-id and display. Only required for X-based GUI's
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
806 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
807 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
808 gui_get_x11_windis(Window * win, Display ** dis)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
809 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
810 *win = /*vmw*/gui.w->winId();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
811 *dis = qt_xdisplay();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
812 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
813 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
814 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
815
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
816 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
817 gui_mch_beep()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
818 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
819 kapp->beep();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
820 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
821
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
822 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
823 gui_mch_flash(int msec)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
824 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
825 gui.w->flash();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
826 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
827
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
828 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
829 * Invert a rectangle from row r, column c, for nr rows and nc columns.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
830 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
831 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
832 gui_mch_invert_rectangle(int r, int c, int nr, int nc)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
833 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
834 bitBlt (
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
835 gui.w,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
836 FILL_X(c), FILL_Y(r),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
837 gui.w,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
838 FILL_X(c), FILL_Y(r),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
839 (nc) * gui.char_width,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
840 (nr) * gui.char_height,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
841 Qt::NotROP, // raster Operation
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
842 true ); // ignoreMask
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
843 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
844
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
845 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
846 * Iconify the GUI window.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
847 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
848 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
849 gui_mch_iconify()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
850 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
851 vmw->showMinimized();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
852 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
853
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
854 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
855 * Draw a cursor without focus.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
856 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
857 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
858 gui_mch_draw_hollow_cursor(guicolor_T color)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
859 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
860 QPainter p(gui.w);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
861 p.setPen( color );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
862
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
863 p.drawRect(FILL_X(gui.col), FILL_Y(gui.row), gui.char_width - 1, gui.char_height - 1 );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
864
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
865 p.end();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
866 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
867
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
868 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
869 * Draw part of a cursor, "w" pixels wide, and "h" pixels high, using
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
870 * color "color".
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
871 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
872 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
873 gui_mch_draw_part_cursor(int w, int h, guicolor_T color)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
874 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
875 QPainter p(gui.w);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
876 p.setPen( color );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
877 p.fillRect(
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
878 FILL_X(gui.col),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
879 FILL_Y(gui.row) + gui.char_height - h +1,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
880 w, h-2, QColor( color, color));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
881 p.drawRect(FILL_X(gui.col),FILL_Y(gui.row) + gui.char_height - h + (int)p_linespace / 2,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
882 w, h - (int)p_linespace );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
883
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
884 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
885
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
886
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
887 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
888 * Catch up with any queued X11 events. This may put keyboard input into the
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
889 * input buffer, call resize call-backs, trigger timers etc. If there is
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
890 * nothing in the X11 event queue (& no timers pending), then we return
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
891 * immediately.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
892 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
893 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
894 gui_mch_update()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
895 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
896 kapp->processEvents();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
897 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
898
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
899
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
900 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
901 * GUI input routine called by gui_wait_for_chars(). Waits for a character
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
902 * from the keyboard.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
903 * wtime == -1 Wait forever.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
904 * wtime == 0 This should never happen.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
905 * wtime > 0 Wait wtime milliseconds for a character.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
906 * Returns OK if a character was found to be available within the given time,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
907 * or FAIL otherwise.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
908 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
909 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
910 gui_mch_wait_for_chars(long wtime)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
911 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
912 // malte@kde.org's gift to KVim ;), thanks to him :) for this hard to find bug
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
913 if (wtime>0) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
914 gui.w->wait( wtime );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
915 while ( vim_is_input_buf_empty() && !gui.w->wait_done )
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
916 kapp->processOneEvent();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
917 return vim_is_input_buf_empty() ? FAIL : OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
918 } else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
919 while (vim_is_input_buf_empty() ) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
920 kapp->processOneEvent();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
921 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
922
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
923 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
924 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
925
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
926
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
927 /****************************************************************************
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
928 * Output drawing routines.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
929 ****************************************************************************/
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
930
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
931
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
932 /* Flush any output to the screen */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
933 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
934 gui_mch_flush()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
935 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
936 kapp->flushX();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
937 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
938
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
939 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
940 * Clear a rectangular region of the screen from text pos (row1, col1) to
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
941 * (row2, col2) inclusive.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
942 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
943 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
944 gui_mch_clear_block(int row1, int col1, int row2, int col2)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
945 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
946 gui.w->erase (FILL_X(col1), FILL_Y(row1),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
947 (col2 - col1 + 1) * gui.char_width+ (col2 == Columns - 1),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
948 (row2 - row1 + 1) * gui.char_height );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
949 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
950
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
951 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
952 gui_mch_clear_all(void)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
953 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
954 gui.w->erase();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
955 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
956
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
957
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
958 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
959 * Delete the given number of lines from the given row, scrolling up any
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
960 * text further down within the scroll region.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
961 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
962 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
963 gui_mch_delete_lines(int row, int num_lines)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
964 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
965 if (num_lines <= 0)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
966 return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
967
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
968 if (row + num_lines > gui.scroll_region_bot) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
969 /* Scrolled out of region, just blank the lines out */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
970 gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
971 } else {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
972 bitBlt (
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
973 gui.w,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
974 FILL_X(gui.scroll_region_left), FILL_Y(row),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
975 gui.w,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
976 FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
977 gui.char_width * (gui.scroll_region_right -gui.scroll_region_left + 1) + 1,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
978 gui.char_height * (gui.scroll_region_bot - row - num_lines + 1),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
979 Qt::CopyROP, // raster Operation
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
980 true ); // ignoreMask
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
981
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
982 /* Update gui.cursor_row if the cursor scrolled or copied over */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
983 if (gui.cursor_row >= row) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
984 if (gui.cursor_row < row + num_lines)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
985 gui.cursor_is_valid = FALSE;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
986 else if (gui.cursor_row <= gui.scroll_region_bot)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
987 gui.cursor_row -= num_lines;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
988 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
989
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
990 gui_clear_block(gui.scroll_region_bot - num_lines + 1, gui.scroll_region_left,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
991 gui.scroll_region_bot, gui.scroll_region_right);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
992
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
993 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
994 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
995
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
996 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
997 * Insert the given number of lines before the given row, scrolling down any
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
998 * following text within the scroll region.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
999 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1000 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1001 gui_mch_insert_lines(int row, int num_lines)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1002 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1003 if (num_lines <= 0)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1004 return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1005
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1006 if (row + num_lines > gui.scroll_region_bot) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1007 /* Scrolled out of region, just blank the lines out */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1008 gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right - 1);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1009 } else {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1010 bitBlt (
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1011 gui.w,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1012 FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1013 gui.w,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1014 FILL_X(gui.scroll_region_left), FILL_Y(row),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1015 gui.char_width * ( gui.scroll_region_right - gui.scroll_region_left + 1 ) + 1,
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1016 gui.char_height * (gui.scroll_region_bot - row - num_lines + 1),
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1017 Qt::CopyROP, // raster Operation
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1018 true ); // ignoreMask
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1019
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1020 /* Update gui.cursor_row if the cursor scrolled or copied over */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1021 if (gui.cursor_row >= gui.row) {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1022 if (gui.cursor_row <= gui.scroll_region_bot - num_lines)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1023 gui.cursor_row += num_lines;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1024 else if (gui.cursor_row <= gui.scroll_region_bot)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1025 gui.cursor_is_valid = FALSE;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1026 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1027
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1028 gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1029 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1030 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1031
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1032 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1033 * X Selection stuff, for cutting and pasting text to other windows.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1034 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1035 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1036 clip_mch_request_selection(VimClipboard *cbd)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1037 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1038 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1039 if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(true);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1040 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1041 QString selection = kapp->clipboard()->text();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1042
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1043 QCString unistring = vmw->codec->fromUnicode(selection);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1044 clip_yank_selection(MCHAR,(char_u *)(const char*)unistring,(long) unistring.length(),cbd);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1045 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1046 if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(false);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1047 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1048 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1049
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1050 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1051 clip_mch_lose_selection(VimClipboard *cbd)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1052 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1053 //Don't need to do anything here
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1054 gui_mch_update();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1055 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1056
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1057 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1058 * Check whatever we allready own the selection.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1059 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1060 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1061 clip_mch_own_selection(VimClipboard *cbd)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1062 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1063 if (kapp->clipboard()->ownsSelection())
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1064 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1065 else {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1066 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1067 kapp->clipboard()->setSelectionMode(true);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1068 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1069 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1070 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1071 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1072
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1073 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1074 * Send the current selection to the clipboard.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1075 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1076 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1077 clip_mch_set_selection(VimClipboard *cbd){//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1078 char_u *data;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1079 long_u length;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1080
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1081 clip_get_selection(cbd);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1082 if(clip_convert_selection(&data,&length,cbd)<0) return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1083
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1084 QString selection((const char *) data);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1085 //We must turncate the string because it is not
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1086 // null terminated
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1087 selection.truncate((uint) length);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1088
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1089 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1090 if (cbd==&clip_star) kapp->clipboard()->setSelectionMode(true);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1091 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1092 kapp->clipboard()->setText(selection);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1093 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1094 kapp->clipboard()->setSelectionMode(false);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1095 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1096 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1097
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1098
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1099 #if defined(FEAT_MENU) || defined(PROTO)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1100 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1101 * Make a menu item appear either active or not active (grey or not grey).
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1102 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1103 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1104 gui_mch_menu_grey(vimmenu_T * menu, int grey)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1105 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1106 if ( !menu || !menu->parent || !menu->parent->widget ) return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1107 menu->parent->widget->setItemEnabled((int)menu, !grey);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1108 gui_mch_update();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1109 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1110
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1111 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1112 * Make menu item hidden or not hidden.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1113 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1114 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1115 gui_mch_menu_hidden(vimmenu_T * menu, int hidden)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1116 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1117 //FIXME: cannot be fixed AFAIK
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1118 gui_mch_menu_grey(menu,hidden); // it's hard to remove an item in a QPopupMenu
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1119 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1120
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1121 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1122 * This is called after setting all the menus to grey/hidden or not.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1123 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1124 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1125 gui_mch_draw_menubar()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1126 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1127 // nothing to do under kde
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1128 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1129 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1130
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1131 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1132 * Scrollbar stuff.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1133 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1134 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1135 gui_mch_enable_scrollbar(scrollbar_T * sb, int flag)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1136 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1137 if (!sb->w) return;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1138 int width = gui.w->width();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1139 int height = gui.w->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1140 int neww = vmw->width();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1141 int newh = vmw->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1142
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1143 if (gui.which_scrollbars[SBAR_LEFT]) width += gui.scrollbar_width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1144 if (gui.which_scrollbars[SBAR_RIGHT]) width += gui.scrollbar_width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1145 if (gui.which_scrollbars[SBAR_BOTTOM]) height += gui.scrollbar_height;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1146
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1147 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1148 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1149 && !vmw->menuBar()->isTopLevelMenu()
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1150 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1151 )
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1152 height += vmw->menuBar()->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1153 #ifdef FEAT_TOOLBAR
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1154 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1155 (vmw->toolBar()->barPos()==KToolBar::Top ||
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1156 vmw->toolBar()->barPos()==KToolBar::Bottom))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1157 height += vmw->toolBar()->height();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1158
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1159 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled() &&
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1160 (vmw->toolBar()->barPos()==KToolBar::Left ||
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1161 vmw->toolBar()->barPos()==KToolBar::Right))
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1162 width += vmw->toolBar()->width();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1163 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1164 if ( abs(vmw->width() - width)>5 && (sb->type==SBAR_LEFT || sb->type==SBAR_RIGHT) )
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1165 neww=width;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1166 if (abs(vmw->height() - height)>5 && (sb->type==SBAR_BOTTOM) )
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1167 newh=height;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1168
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1169 if (flag)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1170 sb->w->show();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1171 else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1172 sb->w->hide();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1173 gui_mch_update();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1174 vmw->lock();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1175 vmw->resize(neww,newh);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1176 vmw->unlock();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1177 gui_mch_update();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1178 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1179
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1180 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1181 * Return the RGB value of a pixel as "#RRGGBB".
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1182 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1183 long_u
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1184 gui_mch_get_rgb(guicolor_T pixel)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1185 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1186 // QColor c(pixel,pixel);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1187 // return (c.red() << 16) + ((c.green() << 8)) + (c.blue());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1188 return pixel; // funny no ? it looks like with Qt we can always use directly the rgb value (i hope i don't break colors again ;p)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1189 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1190
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1191 /*
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1192 * Get current y mouse coordinate in text window.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1193 * Return -1 when unknown.
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1194 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1195 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1196 gui_mch_get_mouse_x(void)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1197 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1198 return vmw->mapFromGlobal( QCursor::pos() ).x();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1199 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1200
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1201 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1202 gui_mch_get_mouse_y(void)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1203 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1204 return vmw->mapFromGlobal( QCursor::pos() ).y();
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1205 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1206
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1207 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1208 gui_mch_setmouse(int x, int y)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1209 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1210 QCursor::setPos( vmw->mapToGlobal( QPoint(x,y)) );
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1211 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1212
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1213 #if defined(FEAT_MOUSESHAPE) || defined(PROTO)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1214 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1215 static int mshape_ids[] = {//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1216 Qt::ArrowCursor, /* arrow */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1217 Qt::BlankCursor, /* blank */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1218 Qt::IbeamCursor, /* beam */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1219 Qt::SizeVerCursor, /* updown */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1220 Qt::SplitHCursor, /* udsizing */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1221 Qt::SizeHorCursor, /* leftright */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1222 Qt::SizeHorCursor, /* lrsizing */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1223 Qt::WaitCursor, /* busy */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1224 Qt::ForbiddenCursor, /* no */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1225 Qt::CrossCursor, /* crosshair */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1226 Qt::PointingHandCursor, /* hand1 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1227 Qt::PointingHandCursor, /* hand2 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1228 Qt::ArrowCursor, /* pencil */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1229 Qt::WhatsThisCursor, /* question */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1230 Qt::ArrowCursor, /* right-arrow */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1231 Qt::UpArrowCursor, /* up-arrow */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1232 Qt::ArrowCursor /* last one */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1233 };//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1234 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1235 static int mshape_ids[] = {//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1236 ArrowCursor, /* arrow */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1237 BlankCursor, /* blank */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1238 IbeamCursor, /* beam */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1239 SizeVerCursor, /* updown */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1240 SplitHCursor, /* udsizing */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1241 SizeHorCursor, /* leftright */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1242 SizeHorCursor, /* lrsizing */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1243 WaitCursor, /* busy */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1244 ForbiddenCursor, /* no */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1245 CrossCursor, /* crosshair */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1246 PointingHandCursor, /* hand1 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1247 PointingHandCursor, /* hand2 */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1248 ArrowCursor, /* pencil */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1249 ArrowCursor, /* question */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1250 ArrowCursor, /* right-arrow */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1251 UpArrowCursor, /* up-arrow */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1252 ArrowCursor /* last one */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1253 };//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1254 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1255
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1256 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1257 mch_set_mouse_shape (int shape)//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1258 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1259 int id;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1260
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1261 if (shape == MSHAPE_HIDE || gui.pointer_hidden)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1262 #if QT_VERSION>=300
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1263 gui.w->setCursor(Qt::BlankCursor);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1264 #else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1265 gui.w->setCursor(BlankCursor);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1266 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1267 else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1268 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1269 if (shape >= MSHAPE_NUMBERED)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1270 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1271 id = shape - MSHAPE_NUMBERED;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1272 /* if (id >= GDK_NUM_GLYPHS)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1273 id = GDK_LEFT_PTR;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1274 else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1275 id &= ~1;*/ /* they are always even (why?) */
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1276 id &= -1;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1277 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1278 else
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1279 id = mshape_ids[shape];
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1280
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1281 gui.w->setCursor(id);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1282 }
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1283 if (shape != MSHAPE_HIDE)
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1284 last_shape = shape;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1285 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1286 #endif
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1287
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1288 int
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1289 gui_mch_adjust_charsize ()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1290 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1291 QFont f(*(gui.current_font));
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1292 QFontMetrics fm (f);
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1293 gui.char_height = fm.height() + p_linespace;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1294 //gui.char_height = fm.ascent() + fm.descent() + p_linespace;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1295 gui.char_ascent = fm.ascent() + p_linespace/2;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1296
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1297 return OK;
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1298 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1299
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1300 void
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1301 gui_mch_set_foreground ()//{{{
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1302 {
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1303 KWin::setActiveWindow(vmw->winId());
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1304 }//}}}
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1305
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1306
4424b47a0797 updated for version 7.0003
vimboss
parents:
diff changeset
1307