void char_win_draw_string(HDC dest_window,RECT dest_rect,char *str,short mode,short line_height) { char store_s[256]; strcpy((char *) store_s,str); win_draw_string( dest_window, dest_rect,store_s, mode, line_height); }
// klugde for speed ...exactly like place location above, but just writes location void place_just_location() { char draw_str[256]; RECT from_rect,draw_rect,erase_rect; HBITMAP store_bmp; HDC hdc; erase_rect.left = terrain_rects[255].left + 17; erase_rect.right = RIGHT_AREA_WIDTH - 1; erase_rect.top = terrain_rects[255].top + 12 - 9; erase_rect.bottom = erase_rect.top + 12; paint_pattern(terrain_buttons_gworld,0,erase_rect,1); hdc = CreateCompatibleDC(main_dc); SetBkMode(hdc,TRANSPARENT); SelectObject(hdc,small_bold_font); store_bmp = (HBITMAP)SelectObject(hdc,terrain_buttons_gworld); draw_rect.left = terrain_rects[255].left + 20; draw_rect.top = terrain_rects[255].top; if (overall_mode < 60) sprintf(draw_str,"Center: x = %d, y = %d ",cen_x,cen_y); else { draw_rect.left = 5; draw_rect.top = terrain_rects[255].top + 28; sprintf(draw_str,"Click terrain to edit. "); } draw_rect.bottom = draw_rect.top + 14; draw_rect.right = draw_rect.left + 200; win_draw_string(hdc,draw_rect,draw_str,0,12); SelectObject(hdc,store_bmp); from_rect = terrain_buttons_rect; from_rect.top = erase_rect.top; from_rect.bottom = erase_rect.bottom; draw_rect = from_rect; OffsetRect(&draw_rect,RIGHT_AREA_UL_X,RIGHT_AREA_UL_Y); rect_draw_some_item(terrain_buttons_gworld,from_rect, terrain_buttons_gworld,draw_rect,0,1); DeleteObject(hdc); }
void cLed::draw(){ rectangle from_rect, to_rect; inWindow->setActive(); if(visible){ TextStyle style; style.pointSize = textSize; style.lineHeight = textSize - 1; style.font = textFont; from_rect = ledRects[state][depressed]; to_rect = frame; to_rect.right = to_rect.left + 14; to_rect.bottom = to_rect.top + 10; rect_draw_some_item(buttons[btnGW[BTN_LED]],from_rect,*inWindow,to_rect); style.colour = textClr; to_rect.right = frame.right; to_rect.left = frame.left + 18; // Possibly could be 20 win_draw_string(*inWindow,to_rect,lbl,wrapLabel ? eTextMode::WRAP : eTextMode::LEFT_TOP,style); } }
void cButton::draw(){ rectangle from_rect, to_rect; inWindow->setActive(); if(visible){ TextStyle style; if(type == BTN_TINY) style.pointSize = 9; else if(type == BTN_PUSH) style.pointSize = 10; else style.pointSize = 12; from_rect = btnRects[type][depressed]; to_rect = frame; if(type == BTN_TINY) { to_rect.right = to_rect.left + 14; to_rect.bottom = to_rect.top + 10; } rect_draw_some_item(buttons[btnGW[type]],from_rect,*inWindow,to_rect,sf::BlendAlpha); style.colour = sf::Color::Black; style.lineHeight = 8; eTextMode textMode = eTextMode::CENTRE; if(type == BTN_TINY) { textMode = wrapLabel ? eTextMode::WRAP : eTextMode::LEFT_TOP; to_rect.left += 18; style.colour = textClr; } else if(type == BTN_PUSH) { to_rect.top += 34; } win_draw_string(*inWindow,to_rect,lbl,textMode,style); // TODO: Adjust string location as appropriate // Tiny button string location should be shifted right 20 pixels (or possibly 18) // Push button string should be centred below the button // Others may need adjustments too, not sure // TODO: How is it supposed to know it's a default button when this fact is stored in the dialog, not the button? if(key.spec && key.k == key_enter) drawFrame(2,frameStyle); // frame default button, to provide a visual cue that it's the default } }
void display_party(short mode,short clear_first) //short mode; // 0 - 5 this pc, 6 - all //short clear_first; // 1 - redraw over what's already there, 0 - don't redraw over { short i,k,string_num, cur_rect=0; Str255 to_draw, skill_value; Rect from_base = {0,0,36,28},from_rect,no_party_rect,temp_rect; // lots of stuff is global. Like ... // bool file_in_mem // short current_active_pc if (clear_first == 1) { // first erase what's already there for (i = 0; i < 6; i++) tileImage(pc_area_buttons[i][0],bg_gworld,bg[12]); tileImage(name_rect,bg_gworld,bg[12]); tileImage(pc_race_rect,bg_gworld,bg[12]); tileImage(info_area_rect,bg_gworld,bg[12]); frame_dlog_rect(GetWindowPort(mainPtr),pc_info_rect,1); // re-draw the frame } if (file_in_mem == false) { // what if no party loaded? no_party_rect=pc_info_rect; no_party_rect.top+=5; no_party_rect.left+=5; char_win_draw_string(mainPtr,no_party_rect,"No party loaded.",0,10); } else { from_rect = pc_info_rect; from_rect.top = from_rect.bottom - 14; if (party_in_scen == false) char_win_draw_string(mainPtr,from_rect,"Party not in a scenario.",0,10); else char_win_draw_string(mainPtr,from_rect,"Party is in a scenario.",0,10); for (i = 0; i < 6; i++) { if (i == current_active_pc) // active pc is drawn in blue ForeColor(blueColor); else ForeColor(blackColor); from_rect = (current_pressed_button == i) ? ed_buttons_from[1] : ed_buttons_from[0]; if ((current_pressed_button < 0) || (current_pressed_button == i)) rect_draw_some_item(buttons_gworld,from_rect,pc_area_buttons[i][0],(Point){0,0}); ForeColor(blackColor); // pc_record_type is the records that contains chaarcters // main_status determins 0 - not exist, 1 - alive, OK, 2 - dead, 3 - stoned, 4 - dust if (univ.party[i].main_status != 0) { // PC exists? from_rect = from_base; // draw PC graphic OffsetRect(&from_rect,56 * (univ.party[i].which_graphic / 8),36 * (univ.party[i].which_graphic % 8)); rect_draw_some_item(pc_gworld,from_rect,pc_area_buttons[i][1],(Point){0,0},transparent); //frame_dlog_rect(GetWindowPort(mainPtr),pc_area_buttons[i][1],0); // draw name TextSize(9); if( (univ.party[i].name.length()) >= 10) { TextFace(0); sprintf((char *) to_draw, "%-s ", (char *) univ.party[i].name.c_str()); TextSize(6); } else { sprintf((char *) to_draw, "%-s ", (char *) univ.party[i].name.c_str()); } ForeColor(whiteColor); win_draw_string(GetWindowPort(mainPtr),pc_area_buttons[i][2],to_draw,1,10); TextFace(bold); TextSize(10); if (i == current_active_pc){ sprintf((char *) to_draw, "%-.18s ", (char *) univ.party[i].name.c_str()); if( (univ.party[i].name.length()) > 12) TextSize(8); ForeColor(blackColor); win_draw_string(GetWindowPort(mainPtr),name_rect,to_draw,1,10); TextSize(10); } if ((current_pressed_button < 0) || (current_pressed_button == i)) switch (univ.party[i].main_status) { // draw statistics case 1: if (i == current_active_pc) { //Draw in race if (univ.party[i].race == 0) char_win_draw_string(mainPtr,pc_race_rect,"Human ",1,10); if (univ.party[i].race == 1) char_win_draw_string(mainPtr,pc_race_rect,"Nephilim ",1,10); if (univ.party[i].race == 2) char_win_draw_string(mainPtr,pc_race_rect,"Slithzerikai ",1,10); // Draw in skills sprintf((char *) to_draw, "Skills:"); win_draw_string(GetWindowPort(mainPtr),skill_rect,to_draw,0,10); sprintf((char *) to_draw, "Hp: %d/%d Sp: %d/%d",univ.party[i].cur_health,univ.party[i].max_health,univ.party[i].cur_sp, univ.party[i].max_sp); win_draw_string(GetWindowPort(mainPtr),hp_sp_rect,to_draw,0,10); TextSize(9); TextFace(0); string_num=1; for( k = 0; k < 19 ; ++k) { temp_rect = pc_skills_rect[k]; temp_rect.left = pc_skills_rect[k].left + 80; get_str(to_draw,9,string_num); win_draw_string(GetWindowPort(mainPtr),pc_skills_rect[k],to_draw,0,9); sprintf((char *) skill_value,"%d",univ.party[i].skills[k]); win_draw_string(GetWindowPort(mainPtr),temp_rect,skill_value,0,9); //frame_dlog_rect(GetWindowPort(mainPtr),pc_skills_rect[k],0); string_num+=2; } //end skills //Write in pc Status TextSize(10); TextFace(bold); sprintf((char *) to_draw, "Status:"); win_draw_string(GetWindowPort(mainPtr),status_rect,to_draw,0,10); TextSize(9); TextFace(0); //for(k = 0 ; k < 10; k++) //frame_dlog_rect(GetWindowPort(mainPtr),pc_status_rect[k],0); if (univ.party[i].status[0] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned Weap.",0,9); cur_rect++; } if (univ.party[i].status[1] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Blessed",0,9); cur_rect++; } else if(univ.party[i].status[1] < 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Cursed",0,9); cur_rect++; } if (univ.party[i].status[2] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned",0,9); cur_rect++; } if (univ.party[i].status[3] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Hasted",0,9); cur_rect++; } else if(univ.party[i].status[3] < 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Slowed",0,9); cur_rect++; } if (univ.party[i].status[4] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Invulnerable",0,9); cur_rect++; } if (univ.party[i].status[5] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Magic Resistant",0,9); cur_rect++; } if (univ.party[i].status[6] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Webbed",0,9); cur_rect++; } if (univ.party[i].status[7] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Diseased",0,9); cur_rect++; } if (univ.party[i].status[8] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Sanctury",0,9); cur_rect++; } if (univ.party[i].status[9] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Dumbfounded",0,9); cur_rect++; } if (univ.party[i].status[10] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Martyr's Shield",0,9); cur_rect++; } if (univ.party[i].status[11] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Asleep",0,9); cur_rect++; } if (univ.party[i].status[12] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Paralyzed",0,9); cur_rect++; } if (univ.party[i].status[13] > 0) if(cur_rect <= 9) { char_win_draw_string(mainPtr,pc_status_rect[cur_rect],"Acid",0,9); cur_rect++; } //end pc status section //Write in Traits TextSize(10); TextFace(bold); sprintf((char *) to_draw, "Traits:"); win_draw_string(GetWindowPort(mainPtr),traits_rect,to_draw,0,10); //for(k = 0 ; k < 16; k++) //frame_dlog_rect(GetWindowPort(mainPtr),pc_traits_rect[k],0); TextSize(9); TextFace(0); cur_rect=0; if (univ.party[i].traits[0] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Toughness",0,9); cur_rect++; } if (univ.party[i].traits[1] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Magically Apt",0,9); cur_rect++; } if (univ.party[i].traits[2] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Ambidextrous",0,9); cur_rect++; } if (univ.party[i].traits[3] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Nimble Fingers",0,9); cur_rect++; } if (univ.party[i].traits[4] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Cave Lore",0,9); cur_rect++; } if (univ.party[i].traits[5] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Woodsman",0,9); cur_rect++; } if (univ.party[i].traits[6] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Good Constitution",0,9); cur_rect++; } if (univ.party[i].traits[7] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Highly Alert",0,9); cur_rect++; } if (univ.party[i].traits[8] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Exceptional Str.",0,9); cur_rect++; } if (univ.party[i].traits[9] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Recuperation",0,9); cur_rect++; } if (univ.party[i].traits[10] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Sluggish",0,9); cur_rect++; } if (univ.party[i].traits[11] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Magically Inept",0,9); cur_rect++; } if (univ.party[i].traits[12] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Frail",0,9); cur_rect++; } if (univ.party[i].traits[13] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Chronic Disease",0,9); cur_rect++; } if (univ.party[i].traits[14] == 1) if(cur_rect <= 15) { char_win_draw_string(mainPtr,pc_traits_rect[cur_rect],"Bad Back",0,9); cur_rect++; } //end traits } ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Alive ",1,10); TextFace(bold); TextSize(10); break; case 2: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Dead ",1,10); TextFace(bold); TextSize(10); break; case 3: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Dust ",1,10); TextFace(bold); TextSize(10); break; case 4: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Stone ",1,10); TextFace(bold); TextSize(10); break; case 5: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Fled ",1,10); TextFace(bold); TextSize(10); break; case 6: ForeColor(whiteColor); TextSize(9); TextFace(0); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Surface ",1,10); TextFace(bold); TextSize(10); break; default: ForeColor(whiteColor); TextFace(0); TextSize(9); char_win_draw_string(mainPtr,pc_area_buttons[i][3],"Absent ",1,10); TextFace(bold); TextSize(10); break; } //frame_dlog_rect(GetWindowPort(mainPtr),pc_area_buttons[i][0],0); } } // Closes the for i=6 loop ForeColor(blackColor); for(i = 0; i < 5; i++) if ((current_pressed_button < 0) || (current_pressed_button == i + 10)) { if (clear_first == 1) { // first erase what's already there tileImage(edit_rect[i][0],bg_gworld,bg[12]); } //frame_dlog_rect(GetWindowPort(mainPtr),edit_rect[i][0],0); //frame_dlog_rect(GetWindowPort(mainPtr),edit_rect[i][1],0); from_rect = (current_pressed_button == i + 10) ? ed_buttons_from[1] : ed_buttons_from[0]; rect_draw_some_item(buttons_gworld,from_rect,edit_rect[i][0],(Point){0,0}); ForeColor(whiteColor); switch(i) { case 0: char_win_draw_string(mainPtr,edit_rect[0][1]," Add Mage Spells ",0,10); break; case 1: char_win_draw_string(mainPtr,edit_rect[1][1]," Add Priest Spells ",0,10); break; case 2: char_win_draw_string(mainPtr,edit_rect[2][1]," Edit Traits",0,10); break; case 3: char_win_draw_string(mainPtr,edit_rect[3][1]," Edit Skills",0,10); break; case 4: char_win_draw_string(mainPtr,edit_rect[4][1]," Edit XP",0,10); break; default: break; } ForeColor(blackColor); } // MoveTo(start_h + 10, start_v + 127); // sprintf((char *) to_draw, " Gold: %d Food: %d ",(short) party.gold, (short) party.food); // DrawString(to_draw); } ForeColor(blackColor); }
void place_location() { char draw_str[256]; RECT draw_rect,source_rect,erase_rect; short picture_wanted; HBITMAP store_bmp; HDC hdc; erase_rect.left = terrain_rects[255].left + 17; erase_rect.right = RIGHT_AREA_WIDTH - 1; erase_rect.top = terrain_rects[255].top + 12 - 10; erase_rect.bottom = erase_rect.top + 12; paint_pattern(terrain_buttons_gworld,0,erase_rect,1); erase_rect.left = 2; erase_rect.right = RIGHT_AREA_WIDTH - 1; erase_rect.top = terrain_rects[255].bottom + 117; erase_rect.bottom = RIGHT_AREA_HEIGHT + 6; paint_pattern(terrain_buttons_gworld,0,erase_rect,1); hdc = CreateCompatibleDC(main_dc); SetBkMode(hdc,TRANSPARENT); SelectObject(hdc,small_bold_font); store_bmp = (HBITMAP)SelectObject(hdc,terrain_buttons_gworld); draw_rect.left = terrain_rects[255].left + 20; draw_rect.top = terrain_rects[255].top; if (overall_mode < 60) sprintf( draw_str,"Center: x = %d, y = %d ", cen_x, cen_y); else { draw_rect.left = 5; draw_rect.top = terrain_rects[255].top + 28; sprintf(draw_str,"Click terrain to edit. "); } draw_rect.bottom = draw_rect.top + 14; draw_rect.right = draw_rect.left + 200; win_draw_string(hdc,draw_rect,draw_str,0,12); SelectObject(hdc,store_bmp); store_bmp = (HBITMAP)SelectObject(hdc,terrain_buttons_gworld); if (overall_mode < 60) { draw_rect.left = 5; draw_rect.top = terrain_rects[255].bottom + 119; draw_rect.bottom = draw_rect.top + 14; draw_rect.right = draw_rect.left + 400; win_draw_string(hdc,draw_rect,current_string,0,12) ; draw_rect.left = RIGHT_AREA_WIDTH / 2; draw_rect.top = terrain_rects[255].bottom + 119; draw_rect.bottom = draw_rect.top + 14; draw_rect.right = draw_rect.left + 200; win_draw_string(hdc,draw_rect,current_string2,0,12) ; } SelectObject(hdc,store_bmp); DeleteObject(hdc); draw_rect.top = palette_buttons[0][0].top + terrain_rects[255].bottom + 5; draw_rect.left = palette_buttons[7][0].right + 17; draw_rect.bottom = draw_rect.top + 36; draw_rect.right = draw_rect.left + 28; picture_wanted = scenario.ter_types[current_terrain_type].picture; if (overall_mode < 60) { if (picture_wanted >= 1000) { source_rect = get_custom_rect(picture_wanted % 1000); rect_draw_some_item(spec_scen_g,source_rect,terrain_buttons_gworld,draw_rect,0,0); } else if (picture_wanted >= 400) { picture_wanted -= 400; source_rect.left = 112 * (picture_wanted / 5); source_rect.right = source_rect.left + 28; source_rect.top = 36 * (picture_wanted % 5); source_rect.bottom = source_rect.top + 36; rect_draw_some_item(anim_gworld,source_rect,terrain_buttons_gworld,draw_rect,0,0); } else { source_rect = get_template_rect(current_terrain_type); rect_draw_some_item(terrain_gworld[picture_wanted / 50],source_rect, terrain_buttons_gworld,draw_rect,0,0); } } draw_rect = terrain_buttons_rect; OffsetRect(&draw_rect,RIGHT_AREA_UL_X,RIGHT_AREA_UL_Y); rect_draw_some_item(terrain_buttons_gworld,terrain_buttons_rect, terrain_buttons_gworld,draw_rect,0,1); }
void cTextField::draw(){ if(!visible) return; static const sf::Color hiliteClr = {127,127,127}, ipClr = {92, 92, 92}; inWindow->setActive(); rectangle outline = frame; outline.inset(-2,-2); fill_rect(*inWindow, outline, sf::Color::White); frame_rect(*inWindow, outline, sf::Color::Black); std::string contents = getText(); TextStyle style; style.font = FONT_PLAIN; style.pointSize = 12; style.colour = sf::Color::Black; style.lineHeight = 16; size_t ip_offset = 0; hilite_t hilite = {insertionPoint, selectionPoint}; if(selectionPoint < insertionPoint) std::swap(hilite.first,hilite.second); if(haveFocus && contents.length() >= 1 && changeMade) { text_rect = frame; text_rect.inset(2,2); // Determine which line the insertion and selection points are on clip_rect(*inWindow, {0,0,0,0}); // To prevent drawing hilite_t tmp_hilite = hilite; // Manipulate this to ensure that there is a hilited area std::string dummy_str = contents + " "; if(tmp_hilite.first >= tmp_hilite.second) tmp_hilite.second = tmp_hilite.first + 1; std::vector<rectangle> rects = draw_string_hilite(*inWindow, text_rect, dummy_str, style, {tmp_hilite}, {0,0,0}); if(!rects.empty()) { // We only care about the first and last rects. Furthermore, we only really need one point location ip_pos = rects[0].centre(), sp_pos = rects[rects.size() - 1].centre(); if(selectionPoint < insertionPoint) std::swap(ip_pos, sp_pos); // Prioritize selection point being visible. If possible, also keep insertion point visible. // We do this by first ensuring the insertion point is visible, then doing the same // for the selection point. while(!ip_pos.in(frame)) { text_rect.offset(0,-14); ip_pos.y -= 14; sp_pos.y -= 14; } while(!sp_pos.in(frame)) { int shift = selectionPoint < insertionPoint ? 14 : -14; text_rect.offset(0,shift); ip_pos.y += shift; sp_pos.y += shift; } } undo_clip(*inWindow); changeMade = false; } clip_rect(*inWindow, frame); ip_col = ip_row = -1; if(haveFocus) { snippets = draw_string_sel(*inWindow, text_rect, contents, style, {hilite}, hiliteClr); int iSnippet = -1, sum = 0; ip_offset = insertionPoint; for(size_t i = 0; i < snippets.size(); i++) { size_t snippet_len = snippets[i].text.length(); sum += snippet_len; if(sum >= insertionPoint) { iSnippet = i; break; } ip_offset -= snippet_len; } std::string pre_ip = iSnippet >= 0 ? snippets[iSnippet].text.substr(0, ip_offset) : ""; ip_offset = string_length(pre_ip, style); if(ip_timer.getElapsedTime().asMilliseconds() < 500) { // printf("Blink on (%d); ", ip_timer.getElapsedTime().asMilliseconds()); rectangle ipRect = {0, 0, 15, 1}; if(iSnippet >= 0) ipRect.offset(snippets[iSnippet].at.x + ip_offset, snippets[iSnippet].at.y + 1); else ipRect.offset(frame.topLeft()), ipRect.offset(3,2); fill_rect(*inWindow, ipRect, ipClr); } else if(ip_timer.getElapsedTime().asMilliseconds() > 1000) { // printf("Blink off (%d); ", ip_timer.getElapsedTime().asMilliseconds()); ip_timer.restart(); } // Record it so that we can calculate up/down arrow key results ip_col = ip_offset; ip_row = iSnippet; } else { rectangle text_rect = frame; text_rect.inset(2,2); win_draw_string(*inWindow, text_rect, contents, eTextMode::WRAP, style); } undo_clip(*inWindow); }