const Cursor& northEastResizeCursor() { BALNotImplemented(); static Cursor c = static_cast<const Cursor&> (SDL_GetCursor()); return c; }
const Cursor& helpCursor() { BALNotImplemented(); static Cursor c = static_cast<const Cursor&> (SDL_GetCursor()); return c; }
void sdl_window::save_mouse_cursor() { iSavedCursors.push_back(cursor_pointer(cursor_pointer(), SDL_GetCursor())); }
const Cursor& rowResizeCursor() { BalNotImplemented(); static Cursor c = static_cast<const Cursor&> (SDL_GetCursor()); return c; }
int HoldCursorPosition(TextEdition *te, SDL_Event event) { int l,c,x,y,done=1,num,select=0; Uint8 *keyState = SDL_GetKeyState(&num); SDL_Rect pt, rect = te->pos; rect.x += te->blitSurfPos.x; rect.y += te->blitSurfPos.y; rect.w -= VSBWidth(*te); rect.h -= HSBHeight(*te); select = SDLK_LSHIFT<num && keyState[SDLK_LSHIFT]; switch(event.type) { case SDL_MOUSEMOTION: if ((SDL_GetMouseState(&x, &y)&SDL_BUTTON(SDL_BUTTON_LEFT))) { if (te->focus && !te->HSBCaught && !te->VSBCaught) { l = GetLineFromYPosition(*te, y); c = GetCharFromXPosition(*te, l, x); select = 1; } else { if (te->HSBCaught) { te->posHSB.x = x - te->anchorHSB - rect.x; SetOffsetFromHSB(te); } else if (te->VSBCaught) { te->posVSB.y = y - te->anchorVSB - rect.y; SetOffsetFromVSB(te); } done = 0; } } else { pt.x = x; pt.y = y; if (TE_EditionCursor && SDL_GetCursor() != TE_EditionCursor && IsInRect(pt,rect) && !HasJustDisplayStyle(te->style)) { SDL_SetCursor(TE_EditionCursor); te->mouseStatus = 1; } else if ( TE_NormalCursor && SDL_GetCursor() != TE_NormalCursor && ((!IsInRect(pt,rect) && te->mouseStatus) || HasJustDisplayStyle(te->style)) ) { SDL_SetCursor(TE_NormalCursor); te->mouseStatus = 0; } done=0; } break; case SDL_MOUSEBUTTONDOWN: if (event.button.button == SDL_BUTTON_LEFT) { if ( (te->focus = IsInRect(event.button,rect)) ) { l = GetLineFromYPosition(*te, event.button.y); c = GetCharFromXPosition(*te, l, event.button.x); } else { if (IsMouseOverHSB(*te,event.button.x,event.button.y)) { te->HSBCaught = 1; te->focus = 1; te->anchorHSB = event.button.x - te->posHSB.x - rect.x; } else if (IsMouseOverVSB(*te,event.button.x,event.button.y)) { te->VSBCaught = 1; te->focus = 1; te->anchorVSB = event.button.y - te->posVSB.y - rect.y; } done = 0; } } else { if (te->focus && event.button.button == SDL_BUTTON_WHEELDOWN) { te->offsetY -= te->hSpace; SetVSBFromOffset(te); } else if (te->focus && event.button.button == SDL_BUTTON_WHEELUP) { te->offsetY += te->hSpace; SetVSBFromOffset(te); } done = 0; } break; case SDL_MOUSEBUTTONUP: if (event.button.button == SDL_BUTTON_LEFT) { te->HSBCaught = 0; te->VSBCaught = 0; } done = 0; break; case SDL_KEYDOWN: done = HoldCursorPosition_Keyboard(te, event, &l, &c); break; default: done=0; break; } if (done) { te->cursorPos = GetPositionInText(*te, l, c); if (!select) te->selection.begin = te->cursorPos; te->selection.end = te->cursorPos; } return done; }
Editor::Editor(Universe &universe) : uni(universe), maxreserve(MAXSTARTRESERVE), all(false), massreserve(maxreserve), setGalaxy(false), setHole(false), galaxyX(0), galaxyY(0), canPut(false), removing(false), size(medium), type(hole), zoom(0), scissors(), pointer() { static const char *image[] = { /* width height num_colors chars_per_pixel */ " 32 32 3 1", /* colors */ "X c #000000", ". c #ffffff", " c None", /* pixels */ " ", " ", " ", " ", " ..... .... ", " ..XXXXX. .XXXX. ", ".XXXXXXXX. .XXXXX. ", ".XXXX..XXX. .XXXXX. ", ".XXX. .XX. .XXXXX. ", ".XXX. .XX. .XXXXX. ", " .XXX..XXX. .XXXXX. ", " ..XXXXXXX. .XXXXX. ", " ..XXXXXX. .XXXXX. ", " ..XXXXX.XXXXX. ", " .XXXXXXXXX. ", " .XXXXXXX. ", " .XXXXXXXXX. ", " ..XXXXX.XXXXX. ", " ..XXXXXX. .XXXXX. ", " ..XXXXXXX. .XXXXX. ", " .XXX..XXX. .XXXXX. ", ".XXX. .XX. .XXXXX. ", ".XXX. .XX. .XXXXX. ", ".XXXX..XXX. .XXXXX. ", ".XXXXXXXX. .XXXXX. ", " ..XXXXX. .XXXX. ", " ..... .... ", " ", " ", " ", " ", " ", "13,15" }; int i, row, col; Uint8 data[4*32]; Uint8 mask[4*32]; int hot_x, hot_y; i = -1; for ( row=0; row<32; ++row ) { for ( col=0; col<32; ++col ) { if ( col % 8 ) { data[i] <<= 1; mask[i] <<= 1; } else { ++i; data[i] = mask[i] = 0; } switch (image[4+row][31-col]) { case 'X': data[i] |= 0x01; mask[i] |= 0x01; break; case '.': mask[i] |= 0x01; break; case ' ': break; } } } sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); pointer = SDL_GetCursor(); scissors = SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y); SDL_SetCursor(pointer); }