Changeset 976
- Timestamp:
- 07/04/08 08:20:58 (2 months ago)
- Files:
-
- trunk/src/Makefile.std (modified) (1 diff)
- trunk/src/main-crb.c (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/Makefile.std
r834 r976 49 49 # Basic compiler stuff 50 50 CC = gcc 51 CFLAGS = - Wall -O2-Wno-unused-parameter51 CFLAGS = -O2 -W -Wall -Wno-unused-parameter 52 52 53 53 trunk/src/main-crb.c
r961 r976 255 255 256 256 static bool CheckEvents(int wait); 257 static OSStatus RevalidateGraphics(term_data *td, EventRef inEvent);257 static OSStatus RevalidateGraphics(term_data *td, bool reset_tilesize); 258 258 static char *locate_lib(char *buf, size_t size); 259 259 static void graphics_aux(int op); … … 781 781 { 782 782 783 /* Enforce minimal size */783 /* Enforce minimal size for the main game window */ 784 784 if (td->cols < 80) td->cols = 80; 785 785 if (td->rows < 24) td->rows = 24; 786 786 787 787 } 788 789 /* Information windows can be much smaller */790 788 else 791 789 { 792 if (td->cols < 5) td->cols = 10; 793 if (td->rows < 10) td->rows = 5; 790 791 /* Information windows can be much smaller */ 792 if (td->cols < 10) td->cols = 10; 793 if (td->rows < 5) td->rows = 5; 794 794 } 795 795 … … 798 798 if (td->rows > 255) td->rows = 255; 799 799 800 /* Minimal tile size */ 800 801 bool dirty = false; 801 /* Minimal tile size */802 802 if (td->tile_wid < td->font_wid) { 803 803 td->tile_wid = td->font_wid; … … 857 857 td->t->always_pict = TRUE; 858 858 } 859 else if (use_graphics && (td == &data[0]))859 else if (use_graphics) 860 860 { 861 861 /* Use higher pict whenever possible */ … … 1191 1191 { 1192 1192 if(frame.tile_images) { 1193 for(int i = frame.rows*frame.cols; --i > 0; ) {1193 for(int i = frame.rows*frame.cols; --i >= 0; ) { 1194 1194 if(frame.tile_images[i]) CGImageRelease(frame.tile_images[i]); 1195 1195 frame.tile_images[i] = 0; … … 1444 1444 GetWindowBounds((WindowRef)td->w, kWindowTitleBarRgn, &tmpR); 1445 1445 int trueTop = td->r.top - (tmpR.bottom-tmpR.top); 1446 MoveWindow((WindowRef)td->w, td->r.left, trueTop, FALSE); 1446 1447 /* Enforce a minimum y position to avoid windows positioned vertically off screen */ 1448 if (trueTop < GetMBarHeight()) trueTop = GetMBarHeight(); 1449 1450 MoveWindowStructure((WindowRef)td->w, td->r.left, trueTop); 1447 1451 1448 1452 … … 2103 2107 FSRefMakePath(&fsRef, (UInt8 *)prefpath, 1024); 2104 2108 mac_warning(format("Preference file has changed. If you have display problems, delete %s/%s.plist and restart.", prefpath, bundlename)); 2109 CFRelease(bundleid); 2105 2110 } 2106 2111 } … … 2173 2178 if (recentItemsLoaded != NULL) 2174 2179 { 2180 CFRelease(recentItemsArrayRef); 2175 2181 recentItemsArrayRef = CFArrayCreateMutableCopy(kCFAllocatorDefault, 0, recentItemsLoaded); 2182 CFRelease(recentItemsLoaded); 2176 2183 redrawRecentItemsMenu(); 2177 2184 } … … 2298 2305 HIViewFindByID(HIViewGetRoot(aboutDialog), aboutDialogName, &aboutDialogViewRef); 2299 2306 HIViewSetText(aboutDialogViewRef, cfstr_applicationName); 2307 CFRelease(cfstr_applicationName); 2300 2308 2301 2309 /* Set the application copyright as set up in variable.c */ … … 2304 2312 strlen(copyright), kCFStringEncodingASCII, false); 2305 2313 HIViewSetText(aboutDialogViewRef, cfstr_applicationCopyright); 2314 CFRelease(cfstr_applicationCopyright); 2306 2315 2307 2316 /* Use a small font for the copyright text */ … … 2495 2504 AppendMenuItemTextWithCFString(m, cfstr, 0, j, NULL); 2496 2505 SetMenuItemRefCon(m, i-MIN_FONT+1, i); 2506 CFRelease(cfstr); 2497 2507 } 2498 2508 } … … 2636 2646 CFStringRef cfstr = CFStringCreateWithCharacters(kCFAllocatorDefault, recentFileName.unicode, recentFileName.length); 2637 2647 AppendMenuItemTextWithCFString(MyGetMenuHandle(kOpenRecentMenu), cfstr, 0, i, NULL); 2648 CFRelease(cfstr); 2638 2649 } 2639 2650 AppendMenuItemTextWithCFString(MyGetMenuHandle(kOpenRecentMenu), CFSTR("-"), kMenuItemAttrSeparator, -1, NULL); … … 2760 2771 for(int i = 0; i < N_ELEMENTS(data); i++) { 2761 2772 if(data[i].mapped) 2762 RevalidateGraphics(&data[i], 0);2773 RevalidateGraphics(&data[i], FALSE); 2763 2774 } 2764 2775 … … 2970 2981 2971 2982 /* Ignore drag effects, other than for moving the mouse origin */ 2972 if(td->rows == y/ td->tile_hgt && td->cols ==x/td->tile_wid)2983 if(td->rows * td->tile_hgt == y && td->cols * td->tile_wid == x) 2973 2984 return noErr; 2974 2985 … … 3055 3066 reset_visuals(TRUE); 3056 3067 } 3057 RevalidateGraphics(&data[0], 0);3068 RevalidateGraphics(&data[0], FALSE); 3058 3069 Term_key_push(KTRL('R')); 3059 3070 } … … 3082 3093 } 3083 3094 3084 RevalidateGraphics(td, inEvent);3095 RevalidateGraphics(td, FALSE); 3085 3096 3086 3097 return noErr; … … 3166 3177 } 3167 3178 3168 static OSStatus RevalidateGraphics(term_data *td, EventRef inEvent) 3169 { 3170 if(!td) return noErr; 3171 3172 HICommand command; 3173 command.commandID = 0; 3174 command.menu.menuRef = 0; 3175 if(inEvent) { 3176 GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, 3177 NULL, sizeof(command), NULL, &command); 3178 } 3179 3180 // Only rescale graphics when absolutely necessary. 3181 if(command.commandID != kTileWidMenu && command.commandID != kTileHgtMenu) 3182 { 3183 // Reset tilesize to default when graphics change. 3179 static OSStatus RevalidateGraphics(term_data *td, bool reset_tilesize) 3180 { 3181 if (!td) return noErr; 3182 3183 /* 3184 * Reset the tilesize on graphics changes; term_data_check_font recalculates 3185 * this after it's been reset. However, only reset the tilesize for default, 3186 * font, and toggle events (not startup - 'Play' 'Band' - or manual changes) 3187 */ 3188 if (reset_tilesize) 3189 { 3184 3190 td->tile_wid = td->tile_hgt = 0; 3185 3191 } 3192 3193 /* Clear the graphics tile cache. */ 3194 graphics_tiles_nuke(); 3186 3195 3187 3196 /* Sanity check for rows, columns, tilesize. */ 3188 3197 term_data_check_font(td); 3189 3198 term_data_check_size(td); 3199 3190 3200 /* Window size changes */ 3191 3201 term_data_resize(td); … … 3246 3256 *toggle_defs[i].var = !(*toggle_defs[i].var); 3247 3257 if(toggle_defs[i].refresh == true) { 3248 RevalidateGraphics(&data[0], inEvent); 3249 graphics_tiles_nuke(); 3258 RevalidateGraphics(&data[0], TRUE); 3250 3259 // Force redraw. 3251 3260 Term_key_push(KTRL('R')); … … 3305 3314 td->font_id = fontID; 3306 3315 td->font_size = size; 3307 RevalidateGraphics(td, 0);3316 RevalidateGraphics(td, TRUE); 3308 3317 } 3309 3318 … … 3832 3841 SetCursor(*(GetCursor(watchCursor))); 3833 3842 3843 /* Prepare the menubar */ 3844 init_menubar(); 3845 3834 3846 /* Ensure that the recent items array is always an array and start with an empty menu */ 3835 3847 recentItemsArrayRef = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); 3836 3848 redrawRecentItemsMenu(); 3837 3838 /* Prepare the menubar */3839 init_menubar();3840 3849 3841 3850 /* Initialize */
