Skip to content

Commit da96508

Browse files
committed
FLTK: fix build
1 parent 80984be commit da96508

File tree

7 files changed

+48
-5
lines changed

7 files changed

+48
-5
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2015-07-18
2+
Added IDE editor sdl/android
3+
14
2015-06-07
25
Fixed PRINT 1/1000 and other floating point rounding issues
36
Fixed problem with 59 char INPUT prompt

src/platform/fltk/MainWindow.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ bool MainWindow::basicMain(EditorWidget *editWidget,
280280
editWidget->readonly(true);
281281
editWidget->runState(rs_run);
282282
breakToLine = editWidget->isBreakToLine();
283-
opt_ide = editWidget->isHideIDE()? IDE_NONE : IDE_LINKED;
283+
opt_ide = editWidget->isHideIDE()? IDE_NONE : IDE_INTERNAL;
284284
}
285285
}
286286

@@ -1024,7 +1024,7 @@ void run_mode_startup(void *data) {
10241024
exit(0);
10251025
}
10261026
editWidget->editor->take_focus();
1027-
opt_ide = IDE_LINKED;
1027+
opt_ide = IDE_INTERNAL;
10281028
}
10291029
}
10301030

@@ -1036,7 +1036,7 @@ bool initialise(int argc, char **argv) {
10361036
opt_quiet = 1;
10371037
opt_verbose = 0;
10381038
opt_nosave = 1;
1039-
opt_ide = IDE_LINKED;
1039+
opt_ide = IDE_INTERNAL;
10401040
opt_pref_bpp = 0;
10411041
opt_interactive = 1;
10421042
opt_file_permitted = 1;

src/platform/fltk/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ sbasici_SOURCES = \
2929
../../ui/inputs.cpp \
3030
../../ui/image.cpp \
3131
../../ui/strlib.cpp \
32+
../../ui/textedit.cpp \
3233
display.cxx display.h \
3334
HelpWidget.cxx HelpWidget.h \
3435
TtyWidget.cxx TtyWidget.h \

src/platform/fltk/dev_fltk.cxx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,26 @@ C_LINKAGE_END
460460

461461
//--FORM------------------------------------------------------------------------
462462

463+
void System::alert(const char *title, const char *message) {
464+
fltk::alert(message);
465+
}
466+
467+
int System::ask(const char *title, const char *prompt, bool cancel) {
468+
if (cancel) {
469+
return fltk::choice(prompt, "Yes", "No", "Cancel");
470+
} else {
471+
return fltk::choice(prompt, "Yes", "No");
472+
}
473+
}
474+
475+
void System::setClipboardText(const char *text) {
476+
fltk::copy(text, strlen(text), true);
477+
}
478+
479+
char *System::getClipboardText() {
480+
return NULL;
481+
}
482+
463483
bool System::isRunning() {
464484
return wnd->isRunning();
465485
}

src/platform/fltk/system.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#define FLTK_SYSTEM_H
1111

1212
struct System {
13+
void alert(const char *title, const char *message);
14+
int ask(const char *title, const char *prompt, bool cancel=true);
15+
void setClipboardText(const char *text);
16+
char *getClipboardText();
1317
bool isBreak();
1418
bool isRunning();
1519
void setLoadPath(const char *url);

src/ui/graphics.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,17 @@ inline pixel_t RGB888_to_RGBA8888(unsigned c) {
6666
#define GET_FROM_RGB888(c) (c)
6767
#endif
6868

69+
#define GET_LINE(y) \
70+
pixel_t *line; \
71+
if (_cacheY == y) { \
72+
line = _cacheLine; \
73+
} else { \
74+
line = _drawTarget->getLine(y); \
75+
_cacheLine = line; \
76+
_cacheY = posY; \
77+
}
78+
79+
6980
// fractional part of x
7081
inline double fpart(double x) {
7182
double result;
@@ -136,7 +147,9 @@ Graphics::Graphics() :
136147
_drawTarget(NULL),
137148
_font(NULL),
138149
_w(0),
139-
_h(0) {
150+
_h(0),
151+
_cacheY(-1),
152+
_cacheLine(NULL) {
140153
graphics = this;
141154
}
142155

@@ -243,7 +256,7 @@ void Graphics::drawPixel(int posX, int posY) {
243256
&& posY >= _drawTarget->y()
244257
&& posX < _drawTarget->w()
245258
&& posY < _drawTarget->h()) {
246-
pixel_t *line = _drawTarget->getLine(posY);
259+
GET_LINE(posY);
247260
line[posX] = _drawColor;
248261
}
249262
}

src/ui/graphics.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ struct Graphics {
7575
Font *_font;
7676
pixel_t _drawColor;
7777
int _w, _h;
78+
int _cacheY;
79+
pixel_t *_cacheLine;
7880
};
7981

8082
}

0 commit comments

Comments
 (0)