bool TextView::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: toClipboard(); break; case 1: saveMe(); break; default: return TextViewGUI::qt_invoke( _id, _o ); } return TRUE; }
static void copyToClipboard(Sprite* sprite) { s32 size = sprite->size * sprite->size * TIC_PALETTE_BPP / BITS_IN_BYTE; u8* buffer = malloc(size); if(buffer) { tic_rect rect = getSpriteRect(sprite); s32 r = rect.x + rect.w; s32 b = rect.y + rect.h; for(s32 y = rect.y, i = 0; y < b; y++) for(s32 x = rect.x; x < r; x++) tic_tool_poke4(buffer, i++, getSheetPixel(sprite, x, y) & 0xf); toClipboard(buffer, size, true); free(buffer); } }
void plotModel(const DirectionModel& model) { std::ostringstream str1; str1 << "Z = ["; int N = 10; for (int x = 0; x < N; x++) { if (x != 0) str1 << ";\n"; for (int y = 0; y < N; y++) { float a = float(x) / float(N), b = float(y) / float(N); float pdf = model.gmm.p(VEC<float, 2>() % a % b); str1 << pdf; if (y != N - 1) str1 << ", "; } } str1 << "];\nX = linspace(0, 1, " << N << ");\nY = linspace(0, 1, " << N << ");\nsurf(X,Y,Z)"; toClipboard(str1.str()); }
void plotPoints(Vec3f* dirs, unsigned int N) { std::ostringstream str1, str2; str1 << "x = ["; str2 << "y = ["; for (size_t i = 0; i < N; i++) { dirs[i] = normalize(dirs[i]); float2 d = make_float2(dirs[i].x, dirs[i].y); str1 << d.x; str2 << d.y; if (i != N - 1) { str1 << ", "; str2 << ", "; } } str1 << "];"; str2 << "];"; str1 << "\n" << str2.str() << "\n" << "scatter(x,y,5)\ngrid on\naxis equal "; std::string plt = str1.str(); toClipboard(plt); }
static void drawRGBTools(Sprite* sprite, s32 x, s32 y) { { enum{Size = 5}; static const u8 Icon[] = { 0b11110000, 0b10010000, 0b10111000, 0b11101000, 0b00111000, 0b00000000, 0b00000000, 0b00000000, }; tic_rect rect = {x, y, Size, Size}; bool over = false; bool down = false; if(checkMousePos(&rect)) { setCursor(tic_cursor_hand); showTooltip("COPY PALETTE"); over = true; if(checkMouseDown(&rect, tic_mouse_left)) down = true; if(checkMouseClick(&rect, tic_mouse_left)) toClipboard(getBankPalette()->data, sizeof(tic_palette), false); } if(down) { drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_light_blue)); } else { drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white)); } } { enum{Size = 5}; static const u8 Icon[] = { 0b01110000, 0b10001000, 0b11111000, 0b11011000, 0b11111000, 0b00000000, 0b00000000, 0b00000000, }; tic_rect rect = {x + 8, y, Size, Size}; bool over = false; bool down = false; if(checkMousePos(&rect)) { setCursor(tic_cursor_hand); showTooltip("PASTE PALETTE"); over = true; if(checkMouseDown(&rect, tic_mouse_left)) down = true; if(checkMouseClick(&rect, tic_mouse_left)) { pasteColor(sprite); } } if(down) { drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_light_blue)); } else { drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black)); drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white)); } } }
void InjectToClipboard(HWND hwnd, std::string data) { Sleep(100); toClipboard(hwnd, data); }
void clipFocusOff() { if (cb_refocusing) cb_refocusing = false; else toClipboard(); }
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ void clipToCB() /* forced to/from clipboard operations */ { if (BlockMark) tecsblock(); // save the block only if one currently selected toClipboard(); // but copy c/p buffer into clipboard regardless }
// Load assets bool ModuleSceneIntro::CleanUp() { LOG("Unloading Intro scene"); if(points.count() > 0) { char buf[DATA_BUFFER]; // Print absolute coordinates --- sprintf_s(buf, "// Pivot %d, %d\nint %s[%d] = {\n", pivot.x, pivot.y, name, points.count() * 2); char line[255] = ""; p2List_item<p2Point<int>>* item = points.getFirst(); while(item != NULL) { App->renderer->DrawQuad({item->data.x, item->data.y, 5, 5}, 255, 255, 255, 255, false); sprintf_s(line, 255, "\t%d, %d,\n", item->data.x, item->data.y); strcat_s(buf, line); item = item->next; } buf[strlen(buf) - 2] = 0; strcat_s(buf, "\n};\n"); // Print relative coordinates --- if(graphics != NULL) { int width, height; SDL_QueryTexture(graphics, NULL, NULL, &width, &height); sprintf_s(line, "\n// Pivot %f, %f\nfloat %s[%d] = {\n", (float)pivot.x / width, (float)pivot.y / height, name, points.count() * 2); strcat_s(buf, line); char line[255] = ""; p2List_item<p2Point<int>>* item = points.getFirst(); while(item != NULL) { App->renderer->DrawQuad({item->data.x, item->data.y, 5, 5}, 255, 255, 255, 255, false); sprintf_s(line, 255, "\t%ff, %ff,\n", (float)item->data.x / width, (float)item->data.y / height); strcat_s(buf, line); item = item->next; } buf[strlen(buf) - 2] = 0; strcat_s(buf, "\n};\n"); } // Write to file --- FILE* f; if(fopen_s(&f, file_coords, "w") == 0) { fputs(buf, f); fclose(f); } // also copy to the clipboard toClipboard(buf, strlen(buf)); points.clear(); if(graphics != NULL) App->textures->Unload(graphics); selected = NULL; } return true; }