annotate src/gui_kde_wid.cc @ 456:c4d200412ae9 v7.0121

updated for version 7.0121
author vimboss
date Mon, 01 Aug 2005 07:19:10 +0000
parents 1154524da1cd
children a5fcf36ef512
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
2 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
4 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
7 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
8
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
9 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
10 * Porting to KDE(2) was done by
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
11 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
12 * (C) 2000 by Thomas Capricelli <orzel@freehackers.org>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
13 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
14 * Please visit http://freehackers.org/kvim for other vim- or
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
15 * kde-related coding.
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
16 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
17 * $Id$
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
18 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
19 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
21 #include <assert.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
22 #include <qpainter.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
23 #include <qevent.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
24 #include <qpushbutton.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
25 #include <qscrollbar.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
26 #include <qlayout.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
27 #include <qclipboard.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
28 #include <qdragobject.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
29 #include <qstrlist.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
30 #include <qmenubar.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
31 #include <qtextcodec.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
32 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
33 #include <qptrlist.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
34 #include <ktip.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
35 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
36 #include <kglobal.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
37 #include <kconfig.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
38 #include <kaboutapplication.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
39 #include <dcopclient.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
40 #include <kaboutkde.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
41 #include <kbugreport.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
42 #include <kurldrag.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
43 #include <kmenubar.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
44 #include <ktoolbar.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
45 #include <kstandarddirs.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
46 #include "gui_kde_wid.h"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
47 #include <qxembed.h>
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
48
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
49 extern "C"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
50 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
51 #include "version.h"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
52 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
53
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
54 // Pixmap for dialog
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
55 #ifdef FEAT_GUI_DIALOG
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
56 # include "../../pixmaps/alert.xpm"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
57 # include "../../pixmaps/error.xpm"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
58 # include "../../pixmaps/generic.xpm"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
59 # include "../../pixmaps/info.xpm"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
60 # include "../../pixmaps/quest.xpm"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
61 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
62
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
63 /**
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
64 * Keycodes recognized by vim.
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
65 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
66 struct special_key {//{{{
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
67 int qtkey;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
68 char_u code0;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
69 char_u code1;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
70 } special_keys[] =
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
71 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
72 {Qt::Key_Up, 'k', 'u'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
73 {Qt::Key_Down, 'k', 'd'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
74 {Qt::Key_Left, 'k', 'l'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
75 {Qt::Key_Right, 'k', 'r'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
76 {Qt::Key_F1, 'k', '1'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
77 {Qt::Key_F2, 'k', '2'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
78 {Qt::Key_F3, 'k', '3'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
79 {Qt::Key_F4, 'k', '4'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
80 {Qt::Key_F5, 'k', '5'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
81 {Qt::Key_F6, 'k', '6'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
82 {Qt::Key_F7, 'k', '7'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
83 {Qt::Key_F8, 'k', '8'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
84 {Qt::Key_F9, 'k', '9'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
85 {Qt::Key_F10, 'k', ';'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
86 {Qt::Key_F11, 'F', '1'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
87 {Qt::Key_F12, 'F', '2'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
88 {Qt::Key_F13, 'F', '3'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
89 {Qt::Key_F14, 'F', '4'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
90 {Qt::Key_F15, 'F', '5'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
91 {Qt::Key_F16, 'F', '6'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
92 {Qt::Key_F17, 'F', '7'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
93 {Qt::Key_F18, 'F', '8'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
94 {Qt::Key_F19, 'F', '9'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
95 {Qt::Key_F20, 'F', 'A'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
96 {Qt::Key_F21, 'F', 'B'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
97 {Qt::Key_F22, 'F', 'C'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
98 {Qt::Key_F23, 'F', 'D'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
99 {Qt::Key_F24, 'F', 'E'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
100 {Qt::Key_F25, 'F', 'F'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
101 {Qt::Key_F26, 'F', 'G'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
102 {Qt::Key_F27, 'F', 'H'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
103 {Qt::Key_F28, 'F', 'I'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
104 {Qt::Key_F29, 'F', 'J'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
105 {Qt::Key_F30, 'F', 'K'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
106 {Qt::Key_F31, 'F', 'L'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
107 {Qt::Key_F32, 'F', 'M'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
108 {Qt::Key_F33, 'F', 'N'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
109 {Qt::Key_F34, 'F', 'O'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
110 {Qt::Key_F35, 'F', 'P'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
111 {Qt::Key_Help, '%', '1'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
112 // { Qt::Key_Undo, '&', '8'}, <= hmmm ?
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
113 {Qt::Key_BackSpace, 'k', 'b'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
114 {Qt::Key_Insert, KS_EXTRA, KE_KINS },
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
115 {Qt::Key_Delete, KS_EXTRA, KE_KDEL },
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
116 {Qt::Key_Home, 'K', '1'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
117 {Qt::Key_End, 'K', '4'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
118 {Qt::Key_Prior, 'K', '3'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
119 {Qt::Key_Next, 'K', '5'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
120 {Qt::Key_Print, '%', '9'},
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
121
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
122 {Qt::Key_Plus, 'K', '6'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
123 {Qt::Key_Minus, 'K', '7'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
124 {Qt::Key_Slash, 'K', '8'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
125 {Qt::Key_multiply, 'K', '9'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
126 {Qt::Key_Enter, 'K', 'A'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
127 {Qt::Key_Period, 'K', 'B'},
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
128
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
129 {Qt::Key_0, 'K', 'C'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
130 {Qt::Key_1, 'K', 'D'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
131 {Qt::Key_2, 'K', 'E'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
132 {Qt::Key_3, 'K', 'F'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
133 {Qt::Key_4, 'K', 'G'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
134 {Qt::Key_5, 'K', 'H'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
135 {Qt::Key_6, 'K', 'I'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
136 {Qt::Key_7, 'K', 'J'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
137 {Qt::Key_8, 'K', 'K'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
138 {Qt::Key_9, 'K', 'L'},
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
139
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
140 /* End of list marker: */
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
141 {0, 0, 0}
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
142 };//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
143
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
144 #ifdef FEAT_CLIENTSERVER
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
145 typedef int (*QX11EventFilter)(XEvent*);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
146 extern QX11EventFilter qt_set_x11_event_filter(QX11EventFilter filter);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
147 static QX11EventFilter oldFilter = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
148 static int kvim_x11_event_filter(XEvent* e);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
149 #endif
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
150 void gui_keypress(QKeyEvent *e);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
151
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
152 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
153 * Return OK if the key with the termcap name "name" is supported.
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
154 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
155 int
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
156 gui_mch_haskey(char_u * name)//{{{
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
157 {
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
158 for (int i = 0; special_keys[i].qtkey != 0; i++)
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
159 if (name[0] == special_keys[i].code0
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
160 && name[1] == special_keys[i].code1)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
161 return OK;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
162 return FAIL;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
163 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
164
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
165 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
166 * custom Frame for drawing ...
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
167 */
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
168 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
169 VimWidget::paintEvent(QPaintEvent *e)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
170 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
171 QRect r = e->rect();
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
172 gui_redraw(r.x(), r.y(), r.width(), r.height());
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
173 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
174
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
175 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
176 VimWidget::draw_string(int x, int y, QString s, int len, int flags)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
177 {
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
178 gui.current_font->setBold(flags & DRAW_BOLD);
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
179 gui.current_font->setUnderline(flags & DRAW_UNDERL);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
180 gui.current_font->setItalic(flags & DRAW_ITALIC);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
181 painter->setBackgroundMode(flags & DRAW_TRANSP
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
182 ? Qt::TransparentMode : Qt::OpaqueMode);
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
183 painter->setFont(*(gui.current_font));
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
184 painter->drawText(x, y, s, len);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
185 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
186
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
187 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
188 VimWidget::mousePressEvent(QMouseEvent *event)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
189 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
190 int button = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
191 int modifiers = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
192 ButtonState state = event->state();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
193 ButtonState buttons = event->button();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
194
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
195 //Look at button states
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
196 if (buttons & QMouseEvent::LeftButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
197 button |= MOUSE_LEFT;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
198 if (buttons & QMouseEvent::RightButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
199 button |= MOUSE_RIGHT;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
200 if (buttons & QMouseEvent::MidButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
201 button |= MOUSE_MIDDLE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
202 //Look for keyboard modifiers
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
203 if (state & QMouseEvent::ShiftButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
204 modifiers |= MOUSE_SHIFT;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
205 if (state & QMouseEvent::ControlButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
206 modifiers |= MOUSE_CTRL;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
207 if (state & QMouseEvent::AltButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
208 modifiers |= MOUSE_ALT;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
209 gui_send_mouse_event(button, event->x(), event->y(), FALSE, modifiers);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
210 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
211 QByteArray params;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
212 QDataStream stream(params, IO_WriteOnly);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
213 stream << kapp->dcopClient()->appId() << button << modifiers
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
214 << gui.row << gui.col;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
215 kapp->dcopClient()->emitDCOPSignal(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
216 "mousePEvent(QCString, int, int, int, int)", params);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
217 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
218 event->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
219 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
220
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
221 #if defined(FEAT_SESSION)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
222 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
223 VimMainWindow::saveGlobalProperties(KConfig *conf)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
224 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
225 //we write a mksession file to a file written in the user's ~/.kde/share/config/
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
226 //the name of the file in saved in 'conf'
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
227 //when restoring app, we source this file
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
228 #if 0 //disabled for release
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
229 QString filename = KGlobal::dirs()->localkdedir() + KGlobal::dirs()->kde_default("config") + kapp->randomString(10);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
230 QString cmd("mksession ");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
231 cmd+=filename;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
232 do_cmdline_cmd((char_u*)cmd.latin1());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
233 conf->writePathEntry("sessionfile", filename);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
234 conf->sync();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
235 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
236 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
237
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
238 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
239 VimMainWindow::readGlobalProperties (KConfig *conf)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
240 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
241 #if 0
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
242 QString filename = conf->readPathEntry("sessionfile");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
243 if (filename.isNull()) return;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
244 QString cmd("source ");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
245 cmd+=filename;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
246 do_cmdline_cmd((char_u*)cmd.latin1());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
247 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
248 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
249 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
250
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
251 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
252 VimMainWindow::wheelEvent (QWheelEvent *event)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
253 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
254 ButtonState state = event->state();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
255 int button = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
256 int modifiers = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
257
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
258 if (event->delta() > 0)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
259 button |= MOUSE_4;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
260 else button |= MOUSE_5;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
261
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
262 if (state & ShiftButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
263 modifiers |= MOUSE_SHIFT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
264 if (state & ControlButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
265 modifiers |= MOUSE_CTRL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
266 if (state & AltButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
267 modifiers |= MOUSE_ALT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
268
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
269 gui_send_mouse_event(button, event->x(), event->y(), FALSE, modifiers);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
270 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
271 QByteArray params;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
272 QDataStream stream(params, IO_WriteOnly);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
273 stream << kapp->dcopClient()->appId() << button << modifiers
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
274 << gui.row << gui.col;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
275 kapp->dcopClient()->emitDCOPSignal(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
276 "mouseWhlEvent(QCString, int, int, int, int)", params);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
277 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
278 event->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
279 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
280
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
281 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
282 VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
283 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
284 ButtonState state = event->state();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
285 ButtonState buttons = event->button();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
286 int modifiers = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
287 int button = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
288
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
289 //Look at button states
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
290 if (buttons & LeftButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
291 button |= MOUSE_LEFT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
292 if (buttons & RightButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
293 button |= MOUSE_RIGHT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
294 if (buttons & MidButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
295 button |= MOUSE_MIDDLE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
296
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
297 //Look for keyboard modifiers
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
298 if (state & ShiftButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
299 modifiers |= MOUSE_SHIFT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
300 if (state & ControlButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
301 modifiers |= MOUSE_CTRL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
302 if (state & AltButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
303 modifiers |= MOUSE_ALT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
304
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
305 gui_send_mouse_event(button, event->x(), event->y(), TRUE, modifiers);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
306 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
307 QByteArray params;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
308 QDataStream stream(params, IO_WriteOnly);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
309 stream << kapp->dcopClient()->appId() << button << modifiers
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
310 << gui.row << gui.col;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
311 kapp->dcopClient()->emitDCOPSignal(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
312 "mouseDblClickEvent(QCString, int, int, int, int)", params);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
313 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
314 event->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
315 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
316
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
317 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
318 VimWidget::mouseMoveEvent(QMouseEvent *event)//{{{
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
319 {
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
320 ButtonState state = event->state();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
321 int modifiers = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
322 int button = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
323
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
324 gui_mch_mousehide(FALSE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
325
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
326 //Look at button states
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
327 //warning: we use state here, this is important !
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
328 if (state & QMouseEvent::LeftButton
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
329 || state & QMouseEvent::RightButton
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
330 || state & QMouseEvent::MidButton)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
331 button |= MOUSE_DRAG;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
332
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
333 //Look for keyboard modifiers
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
334 if (state & ShiftButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
335 modifiers |= MOUSE_SHIFT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
336 if (state & ControlButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
337 modifiers |= MOUSE_CTRL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
338 if (state & AltButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
339 modifiers |= MOUSE_ALT;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
340 if (button != MOUSE_DRAG)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
341 gui_mouse_moved(event->x(), event->y());
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
342 else
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
343 gui_send_mouse_event(MOUSE_DRAG, event->x(), event->y(),
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
344 FALSE, modifiers);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
345 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
346
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
347 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
348 VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
349 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
350 ButtonState state = event->state();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
351 int modifiers = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
352
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
353 //Look for keyboard modifiers
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
354 if (state & ShiftButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
355 modifiers |= MOUSE_SHIFT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
356 if (state & ControlButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
357 modifiers |= MOUSE_CTRL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
358 if (state & AltButton)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
359 modifiers |= MOUSE_ALT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
360
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
361 gui_send_mouse_event(MOUSE_RELEASE, event->x(), event->y(),
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
362 FALSE, modifiers);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
363 event->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
364 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
365
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
366 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
367 * The main widget (everything but toolbar/menubar)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
368 */
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
369 VimWidget::VimWidget(QWidget *parent, const char *name, WFlags f)//{{{
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
370 :QWidget(parent, name, f)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
371 , DCOPObject("KVim")
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
372 #ifdef FEAT_MZSCHEME
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
373 , mzscheme_timer_id(-1)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
374 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
375 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
376 //to be able to show/hide the cursor when moving the mouse
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
377 setMouseTracking(true);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
378 painter = new QPainter(this);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
379
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
380 setKeyCompression(true);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
381 setFocusPolicy(QWidget::StrongFocus);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
382 setAcceptDrops(TRUE); // DND
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
383 blink_state = BLINK_NONE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
384 blink_on_time = 700;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
385 blink_off_time = 400;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
386 blink_wait_time = 250;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
387 connect( &blink_timer, SIGNAL(timeout()), SLOT(blink_cursor()));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
388 connect( &wait_timer, SIGNAL(timeout()), SLOT(wait_timeout()));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
389 setInputMethodEnabled(true);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
390 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
391
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
392 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
393 VimWidget::execNormal(QString command)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
394 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
395 QString cmd("execute 'normal ");
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
396 cmd += command;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
397 cmd += "'";
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
398 QCString unistring = vmw->codec->fromUnicode(cmd);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
399 do_cmdline_cmd((char_u *)(const char*)unistring);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
400 gui_update_screen();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
401 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
402
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
403 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
404 VimWidget::execInsert(QString command)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
405 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
406 QString cmd("execute 'normal i");
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
407 cmd += command;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
408 cmd += "'";
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
409 QCString unistring = vmw->codec->fromUnicode(cmd);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
410 do_cmdline_cmd((char_u *)(const char*)unistring);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
411 gui_update_screen();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
412 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
413
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
414 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
415 VimWidget::execRaw(QString command)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
416 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
417 QString cmd("execute '");
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
418 cmd += command;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
419 cmd += "'";
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
420 QCString unistring = vmw->codec->fromUnicode(cmd);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
421 do_cmdline_cmd((char_u *)(const char*)unistring);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
422 gui_update_screen();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
423 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
424
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
425 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
426 VimWidget::execCmd(QString command)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
427 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
428 QCString unistring = vmw->codec->fromUnicode(command);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
429 do_cmdline_cmd((char_u *)(const char*)unistring);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
430 gui_update_screen();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
431 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
432
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
433 QString
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
434 VimWidget::eval(QString expr)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
435 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
436 #ifdef FEAT_EVAL
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
437 QCString unistring = vmw->codec->fromUnicode(expr);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
438 QString val((const char *)eval_to_string(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
439 (char_u *)(const char*)unistring, NULL));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
440 return val;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
441 #else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
442 return QString::null;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
443 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
444 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
445
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
446 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
447 VimWidget::wait(long wtime)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
448 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
449 if (wait_timer.isActive())
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
450 wait_timer.stop();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
451 wait_done = false;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
452 wait_timer.start( wtime, true);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
453 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
454
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
455 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
456 VimWidget::wait_timeout() //{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
457 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
458 wait_done = true;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
459 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
460
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
461 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
462 VimWidget::dragEnterEvent (QDragEnterEvent *e)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
463 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
464 #if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
465 e->accept(QUriDrag::canDecode(e));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
466 #else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
467 e->ignore();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
468 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
469 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
470
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
471 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
472 VimWidget::dropEvent(QDropEvent *e) // {{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
473 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
474 #if (defined(FEAT_WINDOWS) && defined(HAVE_DROP_FILE)) || defined(PROTO)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
475 QStrList urls;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
476
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
477 char_u **fnames;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
478 int redo_dirs = FALSE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
479 int i;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
480 int n;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
481 int nfiles;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
482 int url = FALSE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
483
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
484 /* Count how many items there may be and normalize delimiters. */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
485
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
486 if (QUriDrag::decode(e, urls))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
487 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
488 n = urls.count();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
489 fnames = (char_u **)lalloc((n+1) * sizeof(char_u *), TRUE);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
490 nfiles = 0;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
491 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
492 QPtrListIterator<char> it(urls);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
493 for (; it.current(); ++it)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
494 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
495 KURL u(*it);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
496 #else
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
497 for (i = 0; i < urls.count(); ++i)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
498 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
499 KURL u(urls.at(i));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
500 #endif
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
501 if (!u.isLocalFile())
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
502 url = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
503 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
504 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
505 fnames[nfiles] = (char_u *)strdup((const char *)u.path());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
506 ++nfiles;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
507 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
508 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
509 /* Real files (i.e. not http and not ftp) */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
510 if (url == FALSE)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
511 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
512 if (nfiles == 1)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
513 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
514 if (mch_isdir(fnames[0]))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
515 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
516 /* Handle dropping a directory on Vim. */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
517 if (mch_chdir((char *)fnames[0]) == 0)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
518 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
519 free(fnames[0]);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
520 fnames[0] = NULL;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
521 redo_dirs = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
522 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
523 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
524 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
525 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
526 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
527 /* Ignore any directories */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
528 for (i = 0; i < nfiles; ++i)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
529 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
530 if (mch_isdir(fnames[i]))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
531 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
532 vim_free(fnames[i]);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
533 fnames[i] = NULL;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
534 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
535 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
536 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
537
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
538 if (0)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
539 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
540 /* Shift held down, change to first file's directory */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
541 if (fnames[0] != NULL && vim_chdirfile(fnames[0]) == OK)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
542 redo_dirs = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
543 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
544 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
545 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
546 char_u dirname[MAXPATHL];
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
547 char_u *s;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
548
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
549 if (mch_dirname(dirname, MAXPATHL) == OK)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
550 for (i = 0; i < nfiles; ++i)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
551 if (fnames[i] != NULL)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
552 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
553 s = shorten_fname(fnames[i], dirname);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
554 if (s != NULL && (s = vim_strsave(s)) != NULL)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
555 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
556 vim_free(fnames[i]);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
557 fnames[i] = s;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
558 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
559 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
560 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
561 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
562
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
563 /* Handle the drop, :edit or :split to get to the file */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
564 handle_drop(nfiles, fnames, FALSE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
565
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
566 if (redo_dirs)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
567 shorten_fnames(TRUE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
568 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
569
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
570 /* Update the screen display */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
571 update_screen(NOT_VALID);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
572 #ifdef FEAT_MENU
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
573 gui_update_menus(0);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
574 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
575 setcursor();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
576 out_flush();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
577 gui_update_cursor(FALSE, FALSE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
578 gui_mch_flush();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
579 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
580 } // }}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
581
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
582 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
583 VimWidget::keyPressEvent(QKeyEvent *e) // {{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
584 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
585 gui_keypress(e);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
586 } // }}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
587
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
588 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
589 gui_keypress(QKeyEvent *e) // {{{
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
590 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
591 int key = (int)e->key();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
592 int modifiers = 0, i;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
593 uchar string[256], string2[256];
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
594 uchar *s, *d;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
595 Qt::ButtonState state = e->state();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
596
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
597 QCString unistring = vmw->codec->fromUnicode(e->text());
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
598 if (unistring.length() > 0)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
599 strncpy((char*)string, (const char*)unistring, unistring.length());
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
600 string[unistring.length()] = 0;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
601 int len = unistring.length();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
602
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
603 // ignore certain keys
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
604 if (key == Qt::Key_Shift
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
605 || key == Qt::Key_Alt
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
606 || key == Qt::Key_Control
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
607 || key == Qt::Key_Meta
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
608 || key == Qt::Key_CapsLock
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
609 || key == Qt::Key_NumLock
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
610 || key == Qt::Key_ScrollLock)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
611 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
612 e->ignore();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
613 return;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
614 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
615
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
616 #ifdef FEAT_MBYTE
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
617 if (input_conv.vc_type != CONV_NONE)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
618 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
619 mch_memmove(string2, string, len);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
620 len = convert_input(string2, len, sizeof(string2));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
621 s = string2;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
622 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
623 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
624 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
625 s = string;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
626 d = string;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
627 for (i = 0; i < len; ++i)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
628 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
629 *d++ = s[i];
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
630 if (d[-1] == CSI && d + 2 < string + sizeof(string))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
631 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
632 /* Turn CSI into K_CSI. */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
633 *d++ = KS_EXTRA;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
634 *d++ = (int)KE_CSI;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
635 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
636 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
637 len = d - string;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
638
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
639
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
640 // change shift-tab (backtab) into S_TAB
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
641 if (key == Qt::Key_BackTab && state & Qt::ShiftButton)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
642 key = Qt::Key_Tab;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
643
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
644 // Change C-@ and C-2 in NUL ? Gtk does this
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
645 if ((key == Qt::Key_2 || key == Qt::Key_At) && state & Qt::ControlButton)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
646 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
647 string[0] = NUL;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
648 len = 1;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
649 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
650 else if (len == 0 && (key == Qt::Key_Space || key == Qt::Key_Tab))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
651 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
652 /* When there are modifiers, these keys get zero length; we need the
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
653 * original key here to be able to add a modifier below. */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
654 string[0] = (key & 0xff);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
655 len = 1;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
656 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
657 /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
658 * that already has the 8th bit set.
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
659 * Don't do this for <S-M-Tab>, that should become K_S_TAB with ALT. */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
660 if (len == 1
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
661 && (key != Qt::Key_BackSpace && key != Qt::Key_Delete)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
662 && (string[0] & 0x80) == 0
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
663 && (state & Qt::AltButton)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
664 && !(key == Qt::Key_Tab && (state & Qt::ShiftButton)))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
665 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
666 string[0] |= 0x80;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
667 #ifdef FEAT_MBYTE
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
668 if (enc_utf8) // convert to utf-8
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
669 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
670 string[1] = string[0] & 0xbf;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
671 string[0] = ((unsigned)string[0] >> 6) + 0xc0;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
672 if (string[1] == CSI)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
673 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
674 string[2] = KS_EXTRA;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
675 string[3] = (int)KE_CSI;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
676 len = 4;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
677 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
678 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
679 len = 2;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
680 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
681 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
682 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
683
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
684 /* Check for special keys, making sure BS and DEL are recognised. */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
685 if (len == 0 || key == Qt::Key_BackSpace || key == Qt::Key_Delete)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
686 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
687 while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
688 i++;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
689 if (special_keys[i].qtkey != 0)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
690 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
691 string[0] = CSI;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
692 string[1] = special_keys[i].code0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
693 string[2] = special_keys[i].code1;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
694 len = -3;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
695 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
696 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
697 for (i = 0; special_keys[i].qtkey != 0 ; i++)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
698 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
699 if (special_keys[i].qtkey == key )
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
700 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
701 string[0] = CSI;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
702 string[1] = special_keys[i].code0;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
703 string[2] = special_keys[i].code1;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
704 len = -3;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
705 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
706 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
707 }*/
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
708 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
709
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
710 if (len == 0)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
711 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
712 //no need to dump that, that's a QT problem, we can't do anything
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
713 //dbf("Unrecognised Key : %X %s", key, e->text().latin1());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
714 e->ignore();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
715 return;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
716 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
717
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
718
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
719 /* Special keys (and a few others) may have modifiers */
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
720 if (len == -3
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
721 || key == Qt::Key_Space
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
722 || key == Qt::Key_Tab
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
723 || key == Qt::Key_Return
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
724 || key == Qt::Key_Enter
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
725 || key == Qt::Key_Escape)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
726 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
727 modifiers = 0;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
728 if (state & Qt::ShiftButton)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
729 modifiers |= MOD_MASK_SHIFT;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
730 if (state & Qt::ControlButton)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
731 modifiers |= MOD_MASK_CTRL;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
732 if (state & Qt::AltButton)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
733 modifiers |= MOD_MASK_ALT;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
734
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
735 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
736 * For some keys a shift modifier is translated into another key
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
737 * code. Do we need to handle the case where len != 1 and
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
738 * string[0] != CSI?
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
739 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
740 if (len == -3)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
741 key = TO_SPECIAL(string[1], string[2]);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
742 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
743 key = string[0];
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
744
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
745 key = simplify_key(key, &modifiers);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
746 if (key == CSI)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
747 key = K_CSI;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
748
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
749 if (IS_SPECIAL(key))
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
750 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
751 string[0] = CSI;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
752 string[1] = K_SECOND(key);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
753 string[2] = K_THIRD(key);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
754 len = 3;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
755 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
756 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
757 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
758 string[0] = key;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
759 len = 1;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
760 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
761
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
762 if (modifiers != 0)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
763 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
764 uchar string2[10];
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
765 string2[0] = CSI;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
766 string2[1] = KS_MODIFIER;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
767 string2[2] = modifiers;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
768 add_to_input_buf(string2, 3);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
769 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
770
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
771 } /* special keys */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
772
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
773 if (len == 1 && ((string[0] == Ctrl_C && ctrl_c_interrupts)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
774 || (string[0] == intr_char && intr_char != Ctrl_C)))
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
775 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
776 trash_input_buf();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
777 got_int = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
778 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
779
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
780 add_to_input_buf(string, len);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
781 if (p_mh)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
782 gui_mch_mousehide(TRUE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
783
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
784 //DCOP Embedding stuff
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
785 //if we are here then the user has type something in the window, thus we can easily imagine that :
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
786 // 1 - text has changed (emit textChanged())
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
787 // 2 - characters were interactively inserted (emit charactersInteractivelyInserted())
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
788 // 3 - cursor position has changed ( emit cursorPositionChanged() )
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
789 // 4 - selection has changed ? dunno yet //XXX
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
790 // 5 - undo changed too ? (each character typed in makes the undo changes anyway)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
791 // conclusion : this makes a lot of things to send to the vim kpart, maybe too much
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
792 // for now i'll just send : keyboardEvent to the kpart with the event string as parameter,
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
793 // with current current position
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
794 // i'll do the same for mouseEvents
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
795 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
796 QByteArray params;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
797 QDataStream stream(params, IO_WriteOnly);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
798 stream << kapp->dcopClient()->appId() << unistring << gui.row << gui.col;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
799 kapp->dcopClient()->emitDCOPSignal(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
800 "keyboardEvent(QCString, QCString, int, int)", params);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
801 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
802 e->ignore();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
803 } // }}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
804
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
805 #ifdef FEAT_CLIENTSERVER
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
806 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
807 VimWidget::serverActivate(WId id) //{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
808 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
809 if (serverName == NULL && serverDelayedStartName != NULL)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
810 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
811 commWindow = id;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
812 (void)serverRegisterName(qt_xdisplay(), serverDelayedStartName);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
813 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
814 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
815 serverChangeRegisteredWindow( qt_xdisplay(), id);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
816 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
817 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
818
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
819 #ifdef FEAT_XIM
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
820
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
821 static int preedit_buf_len = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
822 static int im_preedit_cursor = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
823 static int im_preedit_trailing = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
824
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
825 static void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
826 im_delete_preedit(void)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
827 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
828 char_u bskey[] = {CSI, 'k', 'b'};
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
829 char_u delkey[] = {CSI, 'k', 'D'};
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
830
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
831 if (State & NORMAL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
832 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
833 im_preedit_cursor = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
834 return;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
835 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
836 for (; im_preedit_cursor > 0; --im_preedit_cursor)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
837 add_to_input_buf(bskey, (int)sizeof(bskey));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
838
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
839 for (; im_preedit_trailing > 0; --im_preedit_trailing)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
840 add_to_input_buf(delkey, (int)sizeof(delkey));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
841 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
842
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
843 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
844 im_set_position(int row, int col)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
845 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
846 vmw->w->setMicroFocusHint(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
847 TEXT_X(gui.col),
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
848 TEXT_Y(gui.row), 0, 0, TRUE, &vmw->w->font());
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
849 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
850
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
851 int
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
852 im_is_preediting()
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
853 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
854 return (preedit_start_col != MAXCOL);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
855 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
856
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
857 int
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
858 im_get_feedback_attr(int col)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
859 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
860 if (draw_feedback != NULL && col < preedit_buf_len)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
861 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
862 if (draw_feedback[col] & XIMReverse)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
863 return HL_INVERSE;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
864 else if (draw_feedback[col] & XIMUnderline)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
865 return HL_UNDERLINE;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
866 else
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
867 return hl_attr(HLF_V);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
868 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
869
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
870 return -1;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
871 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
872
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
873 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
874 VimWidget::imStartEvent(QIMEvent *e)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
875 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
876 if (State & CMDLINE)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
877 preedit_start_col = cmdline_getvcol_cursor();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
878 else if (curwin != NULL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
879 getvcol(curwin, &curwin->w_cursor, &preedit_start_col, NULL, NULL);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
880 xic = (XIC)!NULL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
881 e->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
882 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
883
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
884 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
885 VimWidget::imEndEvent(QIMEvent *e)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
886 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
887 uchar string[256];
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
888
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
889 im_delete_preedit();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
890
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
891 QCString unistring = vmw->codec->fromUnicode(e->text());
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
892 if (unistring.length() > 0)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
893 strncpy((char*)string, (const char*)unistring, unistring.length());
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
894 string[unistring.length()] = 0;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
895 int len = unistring.length();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
896
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
897 add_to_input_buf_csi(string, len);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
898 im_preedit_cursor = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
899 im_preedit_trailing = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
900 preedit_start_col = MAXCOL;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
901 preedit_buf_len = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
902 if (draw_feedback)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
903 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
904 free(draw_feedback);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
905 draw_feedback = NULL;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
906 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
907 xic = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
908 e->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
909 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
910
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
911 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
912 VimWidget::imComposeEvent(QIMEvent *e)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
913 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
914 uchar string[256];
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
915 char_u backkey[] = {CSI, 'k', 'l'};
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
916
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
917 im_delete_preedit();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
918
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
919 if (State & NORMAL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
920 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
921 im_preedit_cursor = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
922 return;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
923 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
924
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
925 QCString unistring = vmw->codec->fromUnicode(e->text());
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
926 if (unistring.length() > 0)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
927 strncpy((char*)string, (const char*)unistring,unistring.length());
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
928 string[unistring.length()] = 0;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
929 int len = unistring.length();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
930 add_to_input_buf_csi(string, len);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
931
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
932 preedit_buf_len = e->text().length();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
933 if (draw_feedback == NULL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
934 draw_feedback = (char *)alloc(preedit_buf_len);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
935 else
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
936 draw_feedback = (char *)realloc(draw_feedback, preedit_buf_len);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
937 preedit_end_col = preedit_start_col;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
938
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
939 char_u *p = string;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
940 for (int n = 0; n < preedit_buf_len; n++)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
941 {
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
942 if (n < e->cursorPos() || n >= e->cursorPos() + e->selectionLength())
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
943 draw_feedback[n] = XIMUnderline;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
944 else
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
945 draw_feedback[n] = XIMReverse;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
946 preedit_end_col += (*mb_ptr2cells)(p);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
947 p += (*mb_ptr2len_check)(p);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
948 }
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
949 im_preedit_cursor = e->cursorPos();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
950 im_preedit_trailing = preedit_buf_len - im_preedit_cursor;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
951
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
952 # ifdef FEAT_RIGHTLEFT
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
953 if ((State & CMDLINE) == 0 && curwin != NULL && curwin->w_p_rl)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
954 backkey[2] = 'r';
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
955 # endif
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
956 for (int n = 0; n < im_preedit_trailing; n++)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
957 add_to_input_buf(backkey, (int)sizeof(backkey));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
958
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
959 e->accept();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
960 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
961 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
962
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
963
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
964 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
965 VimMainWindow::lock()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
966 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
967 locked = true;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
968 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
969
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
970 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
971 VimMainWindow::unlock()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
972 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
973 locked = false;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
974 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
975
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
976 bool
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
977 VimMainWindow::isLocked()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
978 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
979 return locked;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
980 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
981
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
982 // ->resize VimWidget if not locked
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
983 //
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
984 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
985 VimMainWindow::resizeEvent(QResizeEvent *e) //{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
986 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
987 if (vmw->isLocked())
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
988 return;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
989 //remove toolbar and menubar height
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
990 int height = e->size().height();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
991 int width = e->size().width();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
992
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
993 if (vmw->menuBar()->isVisible() && vmw->menuBar()->isEnabled()
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
994 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
995 && !vmw->menuBar()->isTopLevelMenu()
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
996 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
997 )
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
998 height -= vmw->menuBar()->height();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
999 #ifdef FEAT_TOOLBAR
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1000 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1001 && (vmw->toolBar()->barPos() == KToolBar::Top
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1002 || vmw->toolBar()->barPos() == KToolBar::Bottom))
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1003 height -= vmw->toolBar()->height();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1004
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1005 if (vmw->toolBar()->isVisible() && vmw->toolBar()->isEnabled()
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1006 && (vmw->toolBar()->barPos() == KToolBar::Left
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1007 || vmw->toolBar()->barPos() == KToolBar::Right))
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1008 width -= vmw->toolBar()->width();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1009 #endif
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1010 height = ((int)(height/gui.char_height))*gui.char_height;
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1011 if (!vmw->isLocked())
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1012 gui_resize_shell(width, height);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1013 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1014
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1015 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1016 VimWidget::focusInEvent(QFocusEvent *fe) // {{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1017 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1018 gui_focus_change(true);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1019
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1020 if (blink_state == BLINK_NONE)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1021 gui_mch_start_blink();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1022 } // }}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1023
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1024 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1025 VimWidget::focusOutEvent(QFocusEvent *fe)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1026 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1027 gui_focus_change(false);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1028
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1029 if (blink_state != BLINK_NONE)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1030 gui_mch_stop_blink();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1031 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1032
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1033 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1034 VimWidget::set_blink_time(long wait, long on, long off)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1035 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1036 blink_wait_time = wait;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1037 blink_on_time = on;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1038 blink_off_time = off;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1039 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1040
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1041 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1042 VimWidget::start_cursor_blinking()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1043 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1044 if (blink_timer.isActive())
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1045 blink_timer.stop();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1046
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1047 /* Only switch blinking on if none of the times is zero */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1048 if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1049 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1050 blink_state = BLINK_ON;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1051 gui_update_cursor(TRUE, FALSE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1052 // The first blink appears after wait_time
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1053 blink_timer.start( blink_wait_time, true);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1054 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1055 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1056
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1057 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1058 VimWidget::blink_cursor()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1059 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1060 if (blink_state == BLINK_ON)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1061 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1062 // set cursor off
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1063 gui_undraw_cursor();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1064 blink_state = BLINK_OFF;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1065 blink_timer.start( blink_off_time, true);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1066 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1067 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1068 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1069 // set cursor on
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1070 gui_update_cursor(TRUE, FALSE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1071 blink_state = BLINK_ON;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1072 blink_timer.start( blink_on_time, true);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1073 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1074 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1075
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1076 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1077 VimWidget::stop_cursor_blinking()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1078 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1079 if (blink_timer.isActive())
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1080 blink_timer.stop();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1081
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1082 if (blink_state == BLINK_OFF)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1083 gui_update_cursor(TRUE, FALSE);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1084
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1085 blink_state = BLINK_NONE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1086 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1087
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1088 #ifdef FEAT_MZSCHEME
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1089 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1090 VimWidget::timerEvent(QTimerEvent * evnt)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1091 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1092 if (evnt->timerId() == mzscheme_timer_id)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1093 timer_proc();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1094 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1095
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1096 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1097 VimWidget::enable_mzscheme_threads()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1098 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1099 mzscheme_timer_id = startTimer(p_mzq);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1100 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1101
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1102 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1103 VimWidget::disable_mzscheme_threads()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1104 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1105 killTimer(mzscheme_timer_id);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1106 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1107 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1108
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1109 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1110 VimWidget::flash()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1111 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1112 QPainter p(this);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1113
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1114 p.setRasterOp(Qt::XorROP);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1115 p.fillRect(geometry(), QColor(0xFF, 0xFF, 0xFF));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1116 p.flush();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1117 //FIXME: Make this a little smarter. Maybe add a timer or something
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1118 usleep(19000);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1119 p.fillRect(geometry(), QColor(0xFF, 0xFF, 0xFF));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1120 p.flush();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1121 p.end();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1122 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1123
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1124
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1125 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1126 * The main Window
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1127 */
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1128 VimMainWindow::VimMainWindow(const char *name , WFlags f)//{{{
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1129 :KMainWindow(0L, name, f)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1130 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1131 #ifdef FEAT_CLIENTSERVER
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1132 oldFilter = qt_set_x11_event_filter(kvim_x11_event_filter);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1133 #endif
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1134 if (echo_wid_arg == 1)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1135 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1136 fprintf(stderr, "WID: %ld\n", (long)winId());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1137 fflush(stderr);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1138 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1139
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1140 w = new VimWidget(this, "main vim widget");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1141 gui.w = w;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1142 setFocusProxy(w);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1143 w->setFocus();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1144 have_tearoff = 0;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1145
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1146 finddlg = new KEdFind(this, 0, false);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1147 repldlg = new KEdReplace(this, 0, false);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1148 QObject::connect(finddlg, SIGNAL(search()), this, SLOT(slotSearch()));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1149 QObject::connect(repldlg, SIGNAL(find()), this, SLOT(slotFind()));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1150 QObject::connect(repldlg, SIGNAL(replace()), this, SLOT(slotReplace()));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1151 QObject::connect(repldlg, SIGNAL(replaceAll()), this,
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1152 SLOT(slotReplaceAll()));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1153
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1154 #ifdef FEAT_TOOLBAR
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1155 connect(toolBar(), SIGNAL(clicked(int)), this, SLOT(menu_activated(int)));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1156 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1157 #ifdef FEAT_CLIENTSERVER
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1158 w->serverActivate(winId());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1159
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1160 if (serverName != NULL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1161 kapp->dcopClient()->registerAs(QCString((const char*)serverName),
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1162 false);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1163 else if (serverDelayedStartName != NULL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1164 kapp->dcopClient()->registerAs(
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1165 QCString((const char*)serverDelayedStartName), false);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1166 else if (argServerName != NULL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1167 kapp->dcopClient()->registerAs(argServerName->utf8(), false);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1168 #else
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1169 if (argServerName != NULL)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1170 kapp->dcopClient()->registerAs(argServerName->utf8(), false);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1171 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1172 QXEmbed::initialize();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1173
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1174 }//{{{
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1175
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1176 bool
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1177 VimMainWindow::queryClose()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1178 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1179 gui_shell_closed();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1180 return true;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1181 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1182
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1183 bool
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1184 VimMainWindow::queryExit()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1185 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1186 return true;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1187 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1188
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1189 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1190 VimMainWindow::menu_activated(int dx)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1191 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1192 #ifdef FEAT_MENU
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1193 if (!dx) // tearoff
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1194 return;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1195 gui_mch_set_foreground();
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1196 gui_menu_cb((VimMenu *)dx);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1197 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1198 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1199
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1200
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1201 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1202 VimMainWindow::clipboard_selection_update()//{{{
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1203 {
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1204 if (kapp->clipboard()->ownsSelection())
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1205 clip_own_selection(&clip_star);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1206 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1207 clip_lose_selection(&clip_star);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1208 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1209
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1210 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1211 VimMainWindow::clipboard_data_update()//{{{
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1212 {
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1213 #if QT_VERSION>=300
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1214 if (kapp->clipboard()->ownsClipboard())
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1215 clip_own_selection(&clip_plus);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1216 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1217 clip_lose_selection(&clip_plus);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1218 #else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1219 if (kapp->clipboard()->ownsSelection())
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1220 clip_own_selection(&clip_star);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1221 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1222 clip_lose_selection(&clip_star);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1223 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1224 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1225
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1226 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1227 VimMainWindow::slotSearch()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1228 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1229 QString find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1230 bool direction_down = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1231 bool casesensitive = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1232 int flags = FRD_FINDNEXT;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1233
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1234 find_text = finddlg->getText();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1235 direction_down = !(finddlg->get_direction());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1236 casesensitive = finddlg->case_sensitive();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1237 // if (casesensitive) find_text = "\\C" + find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1238 // else find_text = "\\c" + find_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1239 if (casesensitive)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1240 flags |= FRD_MATCH_CASE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1241 QCString unistring = vmw->codec->fromUnicode(find_text);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1242 gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1243 (int)direction_down);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1244 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1245
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1246 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1247 VimMainWindow::slotFind()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1248 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1249 QString find_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1250 bool direction_down = TRUE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1251 bool casesensitive = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1252 int flags = FRD_R_FINDNEXT;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1253
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1254 find_text = repldlg->getText();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1255 direction_down = !(repldlg->get_direction());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1256 casesensitive = repldlg->case_sensitive();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1257 // if (casesensitive) find_text = "\\C" + find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1258 // else find_text = "\\c" + find_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1259 if (casesensitive) flags |= FRD_MATCH_CASE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1260
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1261 QCString unistring = vmw->codec->fromUnicode(find_text);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1262 gui_do_findrepl(flags, (char_u *)(const char *)unistring, NULL,
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1263 (int)direction_down);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1264 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1265
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1266 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1267 VimMainWindow::slotReplace()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1268 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1269 QString find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1270 QString repl_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1271 bool direction_down = TRUE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1272 bool casesensitive = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1273 int flags = FRD_REPLACE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1274
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1275 find_text = repldlg->getText();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1276 repl_text = repldlg->getReplaceText();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1277 direction_down = !(repldlg->get_direction());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1278 //if (casesensitive) find_text = "\\C" + find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1279 //else find_text = "\\c" + find_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1280 if (casesensitive) flags |= FRD_MATCH_CASE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1281
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1282 QCString unistring = vmw->codec->fromUnicode(find_text);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1283 QCString unistring2 = vmw->codec->fromUnicode(repl_text);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1284 gui_do_findrepl(flags, (char_u *)(const char *)unistring,
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1285 (char_u *)(const char*)unistring2, (int)direction_down);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1286 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1287
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1288 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1289 VimMainWindow::slotReplaceAll()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1290 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1291 QString find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1292 QString repl_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1293 bool direction_down = TRUE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1294 bool casesensitive = TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1295 int flags = FRD_REPLACEALL;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1296
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1297 find_text = repldlg->getText();
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1298 repl_text = repldlg->getReplaceText();
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1299 direction_down = !(repldlg->get_direction());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1300 casesensitive = repldlg->case_sensitive();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1301 // if (casesensitive) find_text = "\\C" + find_text;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1302 // else find_text = "\\c" + find_text;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1303 if (casesensitive)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1304 flags |= FRD_MATCH_CASE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1305 QCString unistring = vmw->codec->fromUnicode(find_text);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1306 QCString unistring2 = vmw->codec->fromUnicode(repl_text);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1307 gui_do_findrepl(flags, (char_u *)(const char *)unistring,
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1308 (char_u *)(const char*)unistring2, (int)direction_down);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1309 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1310
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1311 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1312 VimMainWindow::showAboutKDE()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1313 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1314 KAboutKDE *kde = new KAboutKDE(this);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1315 kde->show();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1316 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1317
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1318 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1319 VimMainWindow::showAboutApplication()//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1320 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1321 KAboutData *aboutData = new KAboutData(
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1322 "kvim"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1323 , I18N_NOOP("KVim")
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1324 , VIM_VERSION_SHORT
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1325 , I18N_NOOP("Vim in a KDE interface")
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1326 , 0
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1327 , "(c) Vim Team, \":help credits\" for more infos.\nType \":help iccf\" to see how you can help the children in Uganda"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1328 , 0l
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1329 , "http://freehackers.org/kvim"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1330 , "kvim-dev@freenux.org"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1331 );
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1332
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1333 aboutData->addAuthor("Bram Moolenaar",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1334 I18N_NOOP("Main vim author"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1335 "Bram@vim.org",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1336 "http://www.vim.org/");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1337 aboutData->addAuthor("Thomas Capricelli",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1338 I18N_NOOP("KDE porting"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1339 "orzel@freehackers.org",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1340 "http://orzel.freehackers.org");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1341 aboutData->addAuthor("Philippe Fremy",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1342 I18N_NOOP("KDE porting"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1343 "pfremy@chez.com",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1344 "http://www.freehackers.org/kvim");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1345 aboutData->addAuthor("Mark Westcott",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1346 I18N_NOOP("Qtopia porting, maintainer of the Qtopia part"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1347 "mark@houseoffish.org",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1348 "http://houseoffish.org");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1349 aboutData->addAuthor("Mickael Marchand",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1350 I18N_NOOP("KDE porting, maintainer"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1351 "marchand@kde.org",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1352 "http://freenux.org");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1353 aboutData->addAuthor("Many other people",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1354 I18N_NOOP("type :help credits for more infos")
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1355 );
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1356 aboutData->addCredit("Vince Negri",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1357 I18N_NOOP("Antialiasing support, Color fixes"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1358 "vnegri@asl-electronics.co.uk");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1359 aboutData->addCredit("Malte Starostik",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1360 I18N_NOOP("Patch for performance improvement"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1361 "malte@kde.org");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1362 aboutData->addCredit("Mark Stosberg",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1363 I18N_NOOP("Provided a FreeBSD box to debug KVim on BSD"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1364 "mark@summersault.com"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1365 );
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1366 aboutData->addCredit("Henrik Skott",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1367 I18N_NOOP("Font patch when KDE not configured"),
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1368 "henrik.skott@hem.utfors.se"
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1369 );
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1370 aboutData->addCredit("Kailash Sethuraman",
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1371 I18N_NOOP("NetBSD configure/compilation fixes")
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1372 );
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1373 aboutData->setLicenseText(
24
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
1374 "KVim as an extension of Vim follows Vim license.\n\
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
1375 You can read it with \":help license\"\n\
8ff7fd162d3c updated for version 7.0016
vimboss
parents: 20
diff changeset
1376 Or read the file $VIMRUNTIME/doc/uganda.txt.");
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1377
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1378 KAboutApplication *about = new KAboutApplication(aboutData);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1379 about->show();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1380 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1381
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1382 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1383 VimMainWindow::showTipOfTheDay()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1384 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1385 #if QT_VERSION>=300
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1386 KTipDialog::showTip(vmw, QString::null, true);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1387 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1388 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1389
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1390 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1391 VimMainWindow::buffersToolbar()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1392 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1393
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1394 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1395
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1396 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1397 VimMainWindow::showBugReport()
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1398 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1399 KBugReport *bug= new KBugReport(this, true);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1400 bug->show();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1401 }
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1402
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1403 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1404 * Vim Dialog
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1405 *
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1406 * Returns:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1407 * 0: Cancel
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1408 * 1- : nb of the pressed button
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1409 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1410
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1411 VimDialog::VimDialog(int type, /* type of dialog *///{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1412 char_u * title, /* title of dialog */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1413 char_u * message, /* message text */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1414 char_u * buttons, /* names of buttons */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1415 int def_but, /* default button */
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1416 char_u *textfield) /* input field */
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1417 :QDialog(vmw, "vim generic dialog", true), // true is for "modal"
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1418 mapper(this, "dialog signal mapper")
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1419 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1420 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1421 * Create Icon
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1422 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1423 char ** icon_data;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1424 switch (type)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1425 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1426 case VIM_GENERIC:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1427 icon_data = generic_xpm;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1428 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1429 case VIM_ERROR:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1430 icon_data = error_xpm;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1431 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1432 case VIM_WARNING:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1433 icon_data = alert_xpm;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1434 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1435 case VIM_INFO:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1436 icon_data = info_xpm;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1437 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1438 case VIM_QUESTION:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1439 icon_data = quest_xpm;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1440 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1441 default:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1442 icon_data = generic_xpm;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1443 };
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1444 QLabel * icon = new QLabel(this);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1445 icon->setPixmap(QPixmap((const char **) icon_data));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1446 icon->setFixedSize(icon->sizeHint());
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1447
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1448 QLabel * text = new QLabel(QSTR(message), this);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1449 text->setAlignment(AlignHCenter | AlignVCenter | ExpandTabs);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1450
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1451 QStringList buttonText = QStringList::split(DLG_BUTTON_SEP, QSTR(buttons));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1452 int butNb = buttonText.count();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1453
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1454 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1455 * Layout
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1456 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1457
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1458 QVBoxLayout * vly = new QVBoxLayout(this, 5, 5);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1459 QHBoxLayout * hly1 = new QHBoxLayout(vly, 5);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1460 hly1->addWidget(icon);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1461 hly1->addWidget(text);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1462 QHBoxLayout * hly3 = new QHBoxLayout(vly , 5);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1463 if (textfield != NULL)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1464 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1465 entry = new QLineEdit(QSTR(textfield), this);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1466 entry->setText(QSTR(textfield));
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1467 hly3->addWidget(entry);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1468 ret = textfield;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1469 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1470 else
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1471 entry = NULL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1472
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1473 QHBoxLayout * hly2 = new QHBoxLayout(vly, 15);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1474 QString s;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1475 QPushButton * pushButton = 0L;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1476 for (int i = 0; i<butNb; i++)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1477 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1478 s = buttonText[i];
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1479 pushButton = new QPushButton(s, this);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1480 if (s.find('&') != -1)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1481 pushButton->setAccel(s.at(s.find('&') + 1).latin1());
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1482
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1483 hly2->addWidget(pushButton);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1484 if (i == def_but - 1)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1485 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1486 pushButton->setDefault(true);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1487 pushButton->setAutoDefault(true);
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1488 setResult(i + 1);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1489 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1490 connect(pushButton, SIGNAL(clicked()), &mapper, SLOT(map()));
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1491 mapper.setMapping(pushButton, i + 1);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1492 }
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1493 connect(&mapper, SIGNAL(mapped(int)), this, SLOT(done(int)));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1494
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1495 setCaption(QSTR(title));
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1496
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1497 vly->activate();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1498 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1499
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1500 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1501 VimDialog::done(int r)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1502 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1503 if (entry != NULL)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1504 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1505 if (r)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1506 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1507 QCString unistring = vmw->codec->fromUnicode(entry->text());
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1508 STRCPY(ret, (const char*)unistring);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1509 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1510 else
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1511 *ret = NUL;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1512 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1513 QDialog::done(r);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1514 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1515
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1516 /*
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1517 * ScrollBar pool handling
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1518 */
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1519 SBPool::SBPool(void)//{{{
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1520 :mapper(this, "SBPool signal mapper")
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1521 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1522 connect(&mapper, SIGNAL(mapped(int)), this, SLOT(sbUsed(int)));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1523 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1524
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1525
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1526 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1527 SBPool::create(GuiScrollbar * sb, int orient)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1528 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1529 switch(orient)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1530 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1531 case SBAR_HORIZ:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1532 sb->w = new QScrollBar(QScrollBar::Horizontal, vmw);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1533 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1534 case SBAR_VERT:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1535 sb->w = new QScrollBar(QScrollBar::Vertical, vmw);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1536 break;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1537 default:
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1538 sb->w = 0;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1539 return;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1540 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1541
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1542 connect(sb->w, SIGNAL(valueChanged(int)), &mapper, SLOT(map()));
74
1154524da1cd updated for version 7.0031
vimboss
parents: 42
diff changeset
1543 mapper.setMapping(sb->w, (long)sb);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1544 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1545
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1546
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1547 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1548 SBPool::sbUsed(int who)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1549 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1550 GuiScrollbar *sb = (GuiScrollbar*)who;
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1551 gui_drag_scrollbar(sb, sb->w->value(), FALSE);
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1552 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1553
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1554
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1555 void
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1556 SBPool::destroy(GuiScrollbar *sb)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1557 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1558 if (!sb->w)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1559 return;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1560
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1561 delete sb->w;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1562 sb->w = 0;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1563 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1564
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1565 #ifdef FEAT_CLIENTSERVER
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1566 static int
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1567 kvim_x11_event_filter(XEvent* e)//{{{
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1568 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1569 if (e->xproperty.type == PropertyNotify
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1570 && e->xproperty.atom == commProperty
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1571 && e->xproperty.window == commWindow
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1572 && e->xproperty.state == PropertyNewValue)
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1573 serverEventProc(qt_xdisplay(), e);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1574
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1575 if (oldFilter)
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1576 return oldFilter( e );
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1577 return FALSE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1578 }//}}}
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1579 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1580
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1581 //add some QT 3 fonts usefull functions
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1582 #if QT_VERSION<300
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1583 QString
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1584 KVimUtils::toString(QFont *f)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1585 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1586 QStringList l;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1587 l.append(f->family());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1588 l.append(QString::number(f->pointSize()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1589 l.append(QString::number(f->pixelSize()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1590 l.append(QString::number((int)f->styleHint()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1591 l.append(QString::number(f->weight()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1592 l.append(QString::number((int)f->italic()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1593 l.append(QString::number((int)f->underline()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1594 l.append(QString::number((int)f->strikeOut()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1595 l.append(QString::number((int)f->fixedPitch()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1596 l.append(QString::number((int)f->rawMode()));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1597 return l.join(",");
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1598 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1599
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1600 bool
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1601 KVimUtils::fromString(QFont *f, QString descrip)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1602 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1603 QStringList l(QStringList::split(',', descrip));
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1604
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1605 int count = l.count();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1606 if (count != 10 && count != 9)
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1607 return FALSE;
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1608
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1609 f->setFamily(l[0]);
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1610 f->setPointSize(l[1].toInt());
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1611 if (count == 9)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1612 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1613 f->setStyleHint((QFont::StyleHint) l[2].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1614 f->setWeight(l[3].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1615 f->setItalic(l[4].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1616 f->setUnderline(l[5].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1617 f->setStrikeOut(l[6].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1618 f->setFixedPitch(l[7].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1619 f->setRawMode(l[8].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1620 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1621 else
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1622 {
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1623 f->setPixelSize(l[2].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1624 f->setStyleHint((QFont::StyleHint) l[3].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1625 f->setWeight(l[4].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1626 f->setItalic(l[5].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1627 f->setUnderline(l[6].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1628 f->setStrikeOut(l[7].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1629 f->setFixedPitch(l[8].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1630 f->setRawMode(l[9].toInt());
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1631 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1632 return TRUE;
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1633 }
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1634 #endif
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1635
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1636 QString
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1637 KVimUtils::convertEncodingName(QString name)
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1638 {
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1639 if (name.startsWith("ucs") || name.startsWith("utf-16"))
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1640 return QString("utf16");
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1641 if (name == "cp950")
c75153d791d0 updated for version 7.0026
vimboss
parents: 24
diff changeset
1642 return QString("Big5");
20
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1643 return QString();
4ac1dce8dd5e updated for version 7.0012
vimboss
parents:
diff changeset
1644 }