AmendHub

jcs

/

amend

/

amendments

/

101

util: SFGetFile and SFPutFile have different dialog dimensions

Why, Apple?

jcs made amendment 101 20 days ago
--- browser.c Tue Sep 6 14:40:59 2022 +++ browser.c Mon Sep 12 15:42:16 2022 @@ -435,7 +435,7 @@ browser_discard_changes(struct browser *browser) strlcpy(filename, file->filename, sizeof(filename)); CtoPstr(filename); - SFPutFile(centered_sf_dialog(), buf, filename, NULL, &reply); + SFPutFile(centered_sfput_dialog(), buf, filename, NULL, &reply); if (!reply.good) break; @@ -460,7 +460,8 @@ browser_export_patch(struct browser *browser) len = sizeof(Ptr); LGetCell(&amendment, &len, selected, browser->amendment_list); - SFPutFile(centered_sf_dialog(), "\pSave patch as:", NULL, NULL, &reply); + SFPutFile(centered_sfput_dialog(), "\pSave patch as:", NULL, NULL, + &reply); if (!reply.good) return; @@ -472,7 +473,7 @@ browser_apply_patch(struct browser *browser) { SFReply reply; - SFGetFile(centered_sf_dialog(), NULL, NULL, -1, NULL, NULL, &reply); + SFGetFile(centered_sfget_dialog(), NULL, NULL, -1, NULL, NULL, &reply); if (!reply.good) return; --- repo.c Tue Sep 6 14:42:10 2022 +++ repo.c Mon Sep 12 15:57:38 2022 @@ -49,7 +49,7 @@ repo_open(AppFile *file) } else { types[0] = REPO_TYPE; - SFGetFile(centered_sf_dialog(), NULL, NULL, 1, &types, + SFGetFile(centered_sfget_dialog(), NULL, NULL, 1, &types, NULL, &reply); if (!reply.good) return NULL; @@ -80,7 +80,7 @@ repo_create(void) struct bile *bile; short error, fh, i; - SFPutFile(centered_sf_dialog(), "\pCreate new repository:", + SFPutFile(centered_sfput_dialog(), "\pCreate new repository:", "\p", NULL, &reply); if (!reply.good) return NULL; @@ -491,7 +491,7 @@ repo_add_file(struct repo *repo) repo_add_file_filter_repo = repo; repo_add_file_filter_repo_dir = wdir.ioWDDirID; - SFGetFile(centered_sf_dialog(), "\p", repo_add_file_filter, + SFGetFile(centered_sfget_dialog(), "\p", repo_add_file_filter, -1, 0, NULL, &reply); if (!reply.good) return NULL; --- util.c Tue Sep 6 19:08:22 2022 +++ util.c Mon Sep 12 15:51:45 2022 @@ -700,12 +700,25 @@ center_in_screen(short width, short height, bool title } Point -centered_sf_dialog(void) +centered_sfget_dialog(void) { Point p; Rect r; center_in_screen(364, 216, false, &r); + p.h = r.left; + p.v = r.top; + + return p; +} + +Point +centered_sfput_dialog(void) +{ + Point p; + Rect r; + + center_in_screen(320, 200, false, &r); p.h = r.left; p.v = r.top; --- util.h Tue Sep 6 19:12:28 2022 +++ util.h Mon Sep 12 15:42:52 2022 @@ -120,7 +120,8 @@ void about(char *program_name); void progress(char *format, ...); void window_rect(WindowPtr win, Rect *ret); void center_in_screen(short width, short height, bool titlebar, Rect *b); -Point centered_sf_dialog(void); +Point centered_sfget_dialog(void); +Point centered_sfput_dialog(void); Handle xNewHandle(size_t size); Handle xGetResource(ResType type, short id);