Fixed the bug where dialog controls were not drawn.

git-svn-id: http://openexile.googlecode.com/svn/trunk@25 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-04-19 17:48:22 +00:00
parent 4c78d68b2b
commit 457bbe3e85
13 changed files with 105 additions and 106 deletions

View File

@@ -112,69 +112,50 @@ void load_file()
BlockMoveData(&typeList, (*type_list)->osType, 2 * sizeof(OSType));
}
if (sys_7_avail == FALSE) {
/* not reached when using Carbon */
if (ae_loading == FALSE) {
//StandardGetFile(NULL,1,type_list,&s_reply);
// StandardGetFile is not available in Carbon -jmr
/* XXX FIXME general lack of error checking in these nav services calls */
NavGetDefaultDialogCreationOptions(&dialogOptions);
NavCreateChooseFileDialog(&dialogOptions, type_list, NULL,
NULL, NULL, NULL, &theDialog);
NavDialogRun(theDialog);
theAction = NavDialogGetUserAction(theDialog);
if (theAction == kNavUserActionCancel || theAction == kNavUserActionNone) {
NavDialogDispose(theDialog);
return;
}
NavDialogGetReply(theDialog, &dialogReply);
/* SFPGetFile(where,message, NULL, 1, type_list, NULL, &reply,-2000,NULL);
if (reply.good == 0) {
return;
}
if ((error = FSOpen(reply.fName,reply.vRefNum,&file_id)) > 0){
FCD(1064,0);
SysBeep(2);
return;
} */
}
else {
if (ae_loading == FALSE) {
//StandardGetFile(NULL,1,type_list,&s_reply);
// StandardGetFile is not available in Carbon -jmr
/* XXX FIXME general lack of error checking in these nav services calls */
NavGetDefaultDialogCreationOptions(&dialogOptions);
NavCreateChooseFileDialog(&dialogOptions, type_list, NULL,
NULL, NULL, NULL, &theDialog);
NavDialogRun(theDialog);
theAction = NavDialogGetUserAction(theDialog);
if (theAction == kNavUserActionCancel || theAction == kNavUserActionNone) {
NavDialogDispose(theDialog);
return;
}
NavDialogGetReply(theDialog, &dialogReply);
AECountItems(&(dialogReply.selection), &descCount);
for (descNum = 1 ; descNum <= descCount ; descNum++) {
DescType returnedType;
Size actualSize;
AEGetNthPtr(&(dialogReply.selection), descNum, typeWildCard,
&dummyKeyword, &returnedType, (Ptr)(&fileRef),
sizeof(fileRef), &actualSize);
/* we'd get typeFSS on classic Mac OS, but I have omitted that check due to laziness -jmr */
if (returnedType == typeFSRef)
break;
}
if (descNum > descCount) {
/* no valid file reference came back from the dialog - shouldn't happen... */
NavDisposeReply(&dialogReply);
NavDialogDispose(theDialog);
return;
}
FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL,
NULL, &file_to_load, NULL);
AECountItems(&(dialogReply.selection), &descCount);
for (descNum = 1 ; descNum <= descCount ; descNum++) {
DescType returnedType;
Size actualSize;
AEGetNthPtr(&(dialogReply.selection), descNum, typeWildCard,
&dummyKeyword, &returnedType, (Ptr)(&fileRef),
sizeof(fileRef), &actualSize);
/* we'd get typeFSS on classic Mac OS, but I have omitted that check due to laziness -jmr */
if (returnedType == typeFSRef)
break;
}
if (descNum > descCount) {
/* no valid file reference came back from the dialog - shouldn't happen... */
NavDisposeReply(&dialogReply);
NavDialogDispose(theDialog);
return;
}
if ((error = FSpOpenDF(&file_to_load,1,&file_id)) != 0) {
FCD(1064,0);
SysBeep(2);
return;
}
FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL,
NULL, &file_to_load, NULL);
NavDisposeReply(&dialogReply);
NavDialogDispose(theDialog);
}
if ((error = FSpOpenDF(&file_to_load,1,&file_id)) != 0) {
FCD(1064,0);
SysBeep(2);
return;
}
file_size = sizeof(party_record_type);

View File

@@ -145,15 +145,13 @@ int main(void)
// register_flag = get_reg_data();
load_sounds();
if (sys_7_avail == TRUE) {
set_up_apple_events();
}
set_up_apple_events();
menu_bar_handle = GetNewMBar(128);
if (menu_bar_handle == NIL) {
SysBeep(2);
ExitToShell();
}
}
SetMenuBar(menu_bar_handle);
DisposeHandle(menu_bar_handle);
@@ -784,12 +782,12 @@ void update_item_menu()
}
}
void set_cursor(CursHandle which_curs)
{
HLock ((Handle) which_curs);
SetCursor (*which_curs);
HUnlock((Handle) which_curs);
}
//void set_cursor(CursHandle which_curs)
//{
// HLock ((Handle) which_curs);
// SetCursor (*which_curs);
// HUnlock((Handle) which_curs);
//}
void find_quickdraw() {
OSErr err;

View File

@@ -25,7 +25,6 @@
/* Begin PBXBuildFile section */
2BF04B0B0BF51924006C0831 /* boe.main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACB0BF51923006C0831 /* boe.main.cpp */; };
2BF04B0C0BF51924006C0831 /* boe.graphutil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACD0BF51923006C0831 /* boe.graphutil.cpp */; };
2BF04B0D0BF51924006C0831 /* boe.actions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACF0BF51923006C0831 /* boe.actions.cpp */; };
2BF04B0E0BF51924006C0831 /* boe.fileio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD10BF51923006C0831 /* boe.fileio.cpp */; };
2BF04B100BF51924006C0831 /* boe.townspec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD50BF51923006C0831 /* boe.townspec.cpp */; };
2BF04B1C0BF51924006C0831 /* boe.combat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AE60BF51924006C0831 /* boe.combat.cpp */; };
@@ -44,6 +43,8 @@
2BF04B2E0BF51924006C0831 /* boe.town.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04B090BF51924006C0831 /* boe.town.cpp */; };
2BF04DE90BF7A6FE006C0831 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; };
91278C340F9A4AC8007B0D52 /* dlglowlevel.h in Headers */ = {isa = PBXBuildFile; fileRef = 91B3F09A0F97672700BF5B67 /* dlglowlevel.h */; };
9127903E0F9B7F49007B0D52 /* boe.actions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04ACF0BF51923006C0831 /* boe.actions.cpp */; };
9127903F0F9B7F50007B0D52 /* boe.graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD30BF51923006C0831 /* boe.graphics.cpp */; };
91B3EF1E0F969C4B00BF5B67 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BF04DE80BF7A6FE006C0831 /* Carbon.framework */; };
91B3EF1F0F969C9C00BF5B67 /* BoECharEd.icns in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EF110F969BD300BF5B67 /* BoECharEd.icns */; };
91B3EF200F969C9C00BF5B67 /* bladespced.rsrc in Resources */ = {isa = PBXBuildFile; fileRef = 91B3EF120F969BD300BF5B67 /* bladespced.rsrc */; };
@@ -90,7 +91,6 @@
91D635B90F90E7D200674AB3 /* valleydy.meg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AD0F90E7B500674AB3 /* valleydy.meg */; };
91D635BA0F90E7D200674AB3 /* zakhazi.exs in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AE0F90E7B500674AB3 /* zakhazi.exs */; };
91D635BB0F90E7D200674AB3 /* zakhazi.meg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 91D635AF0F90E7B500674AB3 /* zakhazi.meg */; };
91EBE6D90F9A15BD002356F2 /* boe.graphics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BF04AD30BF51923006C0831 /* boe.graphics.cpp */; };
91EBE8AB0F9A2BE1002356F2 /* scen.locutils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91EBE8AA0F9A2BE1002356F2 /* scen.locutils.cpp */; };
/* End PBXBuildFile section */
@@ -790,7 +790,6 @@
files = (
2BF04B0B0BF51924006C0831 /* boe.main.cpp in Sources */,
2BF04B0C0BF51924006C0831 /* boe.graphutil.cpp in Sources */,
2BF04B0D0BF51924006C0831 /* boe.actions.cpp in Sources */,
2BF04B0E0BF51924006C0831 /* boe.fileio.cpp in Sources */,
2BF04B100BF51924006C0831 /* boe.townspec.cpp in Sources */,
2BF04B1C0BF51924006C0831 /* boe.combat.cpp in Sources */,
@@ -807,7 +806,8 @@
2BF04B2C0BF51924006C0831 /* boe.startup.cpp in Sources */,
2BF04B2D0BF51924006C0831 /* boe.text.cpp in Sources */,
2BF04B2E0BF51924006C0831 /* boe.town.cpp in Sources */,
91EBE6D90F9A15BD002356F2 /* boe.graphics.cpp in Sources */,
9127903E0F9B7F49007B0D52 /* boe.actions.cpp in Sources */,
9127903F0F9B7F50007B0D52 /* boe.graphics.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -968,7 +968,10 @@
2BF04AC50BF518D4006C0831 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
ARCHS = (
i386,
ppc,
);
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
@@ -997,7 +1000,10 @@
2BF04AC60BF518D4006C0831 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
ARCHS = (
i386,
ppc,
);
COPY_PHASE_STRIP = YES;
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
@@ -1160,7 +1166,10 @@
91B3F07B0F975C7300BF5B67 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
ARCHS = (
i386,
ppc,
);
CONFIGURATION_BUILD_DIR = misc;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -1190,7 +1199,10 @@
91B3F07C0F975C7300BF5B67 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
ARCHS = (
i386,
ppc,
);
CONFIGURATION_BUILD_DIR = misc;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -1219,7 +1231,10 @@
91B3F1050F97799300BF5B67 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
ARCHS = (
i386,
ppc,
);
CONFIGURATION_BUILD_DIR = misc;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -1249,7 +1264,10 @@
91B3F1060F97799300BF5B67 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = ppc;
ARCHS = (
i386,
ppc,
);
CONFIGURATION_BUILD_DIR = misc;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";

View File

@@ -2092,9 +2092,9 @@ void increase_age()////
if (party.stuff_done[SDF_PARTY_STEALTHY] == 1) {reset_text_bar();
add_string_to_buf("Your footsteps grow louder. "); }
party.stuff_done[SDF_PARTY_STEALTHY] = move_to_zero(party.stuff_done[SDF_PARTY_STEALTHY]);
if (party.stuff_done[SDF_PARTY_DETECT_MONST] == 1) {reset_text_bar();
if (party.stuff_done[SDF_PARTY_DETECT_LIFE] == 1) {reset_text_bar();
add_string_to_buf("You stop detecting monsters. ");}
party.stuff_done[SDF_PARTY_DETECT_MONST] = move_to_zero(party.stuff_done[SDF_PARTY_DETECT_MONST]);
party.stuff_done[SDF_PARTY_DETECT_LIFE] = move_to_zero(party.stuff_done[SDF_PARTY_DETECT_LIFE]);
if (party.stuff_done[SDF_PARTY_FIREWALK] == 1) {reset_text_bar();
add_string_to_buf("Your feet stop glowing. ");}
party.stuff_done[SDF_PARTY_FIREWALK] = move_to_zero(party.stuff_done[SDF_PARTY_FIREWALK]);

View File

@@ -929,7 +929,7 @@ void set_gworld_fonts(short font_num)
void redraw_screen(){
switch (overall_mode) {
case 20:
put_background();
put_background();
break;
default:
draw_main_screen();
@@ -938,7 +938,7 @@ void redraw_screen(){
if (overall_mode == MODE_COMBAT)
draw_pcs(pc_pos[current_pc],1);
if (overall_mode == MODE_FANCY_TARGET)
draw_targets(center);
draw_targets(center);
break;
}
put_pc_screen();
@@ -1121,8 +1121,8 @@ void draw_text_bar(short mode)
if (mode == 1)
remember_tiny_text = 500;
if ((PSD[SDF_PARTY_STEALTHY] > 0) || (PSD[SDF_PARTY_FLIGHT] > 0) ||
(PSD[SDF_PARTY_DETECT_MONST] > 0) || (PSD[SDF_PARTY_FIREWALK] > 0) )
if ((PSD[SDF_PARTY_STEALTHY] > 0) || (PSD[SDF_PARTY_FLIGHT] > 0) ||
(PSD[SDF_PARTY_DETECT_LIFE] > 0) || (PSD[SDF_PARTY_FIREWALK] > 0) )
remember_tiny_text = 500;
if (is_out()) {
for (i = 0; i < 8; i++)

View File

@@ -32,7 +32,7 @@ extern pc_record_type adven[6];
extern big_tr_type t_d;
extern location pc_pos[6];
extern CursHandle sword_curs;
//extern CursHandle sword_curs;
extern Boolean modeless_exists[18],diff_depth_ok;
extern short modeless_key[18];
extern DialogPtr modeless_dialogs[18];

View File

@@ -20,9 +20,9 @@
#include "graphtool.h"
#include "mathutil.h"
extern short arrow_curs[3][3];
extern short sword_curs, boot_curs, drop_curs, target_curs;
extern short talk_curs, key_curs, look_curs, current_cursor;
//extern short arrow_curs[3][3];
//extern short sword_curs, boot_curs, drop_curs, target_curs;
//extern short talk_curs, key_curs, look_curs, current_cursor;
/* Mac stuff globals */
Rect windRect, Drag_Rect;
@@ -57,7 +57,7 @@ short on_spell_menu[2][62];
short on_monst_menu[256];
// Cursors
//short current_cursor = 120;
extern short current_cursor;
// Shareware globals
@@ -332,7 +332,7 @@ void Handle_One_Event()
}
//(cur_time - last_anim_time > 42)
if ((cur_time % 40 == 0) && (in_startup_mode == FALSE) && (anim_onscreen == TRUE) && (PSD[306][9] == 0)
if ((cur_time % 40 == 0) && (in_startup_mode == FALSE) && (anim_onscreen == TRUE) && (PSD[SDF_NO_TER_ANIM] == 0)
&& ((FrontWindow() == mainPtr) || (FrontWindow() ==GetDialogWindow(modeless_dialogs[5]))) && (!gInBackground)) {
last_anim_time = cur_time;
initiate_redraw();
@@ -1008,8 +1008,8 @@ void handle_music_menu(int item_hit)
}
//else end_music(1);
if (bgm_on == TRUE)
party.stuff_done[306][5] = 1;
else party.stuff_done[306][5] = 0;
party.stuff_done[SDF_NO_SHORE_FRILLS] = 1;
else party.stuff_done[SDF_NO_SHORE_FRILLS] = 0;
break;
}
}

View File

@@ -21,7 +21,6 @@ void handle_mage_spells_menu(int item_hit);
void handle_priest_spells_menu(int item_hit);
void handle_monster_info_menu(int item_hit);
void handle_music_menu(int item_hit);
void set_cursor(CursHandle which_curs);
void change_cursor(Point where_curs);
void find_quickdraw();
void set_pixel_depth();

View File

@@ -110,7 +110,7 @@ extern location pc_pos[6],center;
extern WindowPtr mainPtr;
extern Boolean in_startup_mode,spell_forced,save_maps,suppress_stat_screen,boom_anim_active;
extern stored_items_list_type stored_items[3];
extern CursHandle sword_curs;
//extern CursHandle sword_curs;
extern setup_save_type setup_save;
extern short store_mage, store_priest;
extern short store_mage_lev, store_priest_lev;

View File

@@ -54,7 +54,7 @@ extern short overall_mode,which_combat_type,stat_window;
extern WindowPtr mainPtr;
extern Rect more_info_button;
extern short which_item_page[6],current_cursor;
extern CursHandle sword_curs;
//extern CursHandle sword_curs;
extern ControlHandle text_sbar,item_sbar;
extern Point store_anim_ul;
extern PixPatHandle bg[14];
@@ -1530,9 +1530,7 @@ Rect coord_to_rect(short i,short j)
void make_cursor_sword()
{
HLock ((Handle) sword_curs);
SetCursor (*sword_curs);
HUnlock((Handle) sword_curs);
set_cursor(sword_curs);
}
void get_str(Str255 str,short i, short j)

View File

@@ -745,14 +745,14 @@ void cd_key_label(short dlog_num, short item_num,short loc){
void cd_draw_item(short dlog_num,short item_num){
short dlg_index,item_index,store_label;
RGBColor c[3] = {{0,0,0},{65535,0,0},{0,0,8192}};
RGBColor c[3] = {{65535,65535,65535},{65535,0,0},{0,0,8192}};
Rect from_rect,to_rect;
GrafPtr old_port;
//printf("In cd_draw_item(%i,%i)\n",dlog_num,item_num);
if (dlgs[dlg_index].draw_ready == FALSE)
return;
if (cd_get_indices(dlog_num,item_num,&dlg_index,&item_index) < 0)
return;
if (dlgs[dlg_index].draw_ready == FALSE)
return;
printf("Drawing item %i of type %i\n",item_num,items[item_index].type);
GetPort(&old_port);
SetPortWindowPort(dlgs[dlg_index].win);
@@ -816,8 +816,7 @@ void cd_draw_item(short dlog_num,short item_num){
TextFont(geneva_font_num);
TextFace(0);
TextFace(bold);
TextSize(10);
ForeColor(blackColor);
TextSize(10);
if (items[item_index].type == DLG_TEXT_PLAIN)
TextFace(0);
if (items[item_index].type == DLG_TEXT_LARGE)
@@ -825,10 +824,10 @@ void cd_draw_item(short dlog_num,short item_num){
ForeColor(blackColor);
if (items[item_index].flag % 10 == 1)
cd_frame_item(dlog_num,item_num,2);
if (items[item_index].flag >= 10) {
if (items[item_index].flag >= 10) {
RGBForeColor(&c[1]);
}printf("Testing 1...\n");
}else RGBForeColor(&c[0]);
printf("Testing 1...\n");
printf("Rect is top = %i, left = %i, bottom = %i, right = %i\n",items[item_index].rect.top,items[item_index].rect.left,items[item_index].rect.bottom,items[item_index].rect.right);
if (items[item_index].rect.bottom - items[item_index].rect.top < 20) {
items[item_index].rect.left += 3;

View File

@@ -6,6 +6,7 @@
*
*/
#define _GRAPHTOOL_CPP
#include "graphtool.h"
//CursHandle arrow_curs[3][3], sword_curs, boot_curs, key_curs, target_curs,talk_curs,look_curs;

View File

@@ -21,4 +21,9 @@ short string_length(char *str);
//OSStatus flip_pict(OSType domain, OSType type, short id, void *ptr, UInt32 size, Boolean isNative, void *refcon);
//void draw_terrain();
Rect calc_rect(short i, short j);
Rect get_custom_rect (short which_rect);
Rect get_custom_rect (short which_rect);
#ifndef _GRAPHTOOL_CPP
extern short arrow_curs[3][3];
extern short sword_curs, boot_curs, drop_curs, target_curs;
extern short talk_curs, key_curs, look_curs, current_cursor;
#endif