source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm@ 579

Last change on this file since 579 was 568, checked in by krille_n_@…, 10 years ago

Changes:

  • SerDrive: Using named pipe mode (serdrive -p) now works under Windows XP/2000/Server 2003.
  • checksum.pl: Added a compatibility fix for 3Com 3C503 cards.
  • XTIDECFG will now scan every possible segment address to find and load the BIOS and/or its settings from EEPROM. This should simplify things for people using combined option ROMs.
  • Fixed a bug from r521 in BootSector.asm where the BIOS would not display a timeout error if it failed to load the boot sector from harddrive.
  • Fixed a bug from r541 in CompatibleDPT.asm where CompatibleDPT_CreateDeviceParameterTableExtensionToESBXfromDPTinDSSI would generate an invalid checksum in the DPTE.
  • Optimizations and other fixes.
File size: 22.8 KB
RevLine 
[41]1; Project name : Assembly Library
2; Description : Displays file dialog.
3
[376]4;
[505]5; XTIDE Universal BIOS and Associated Tools
[526]6; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]7;
8; This program is free software; you can redistribute it and/or modify
9; it under the terms of the GNU General Public License as published by
10; the Free Software Foundation; either version 2 of the License, or
11; (at your option) any later version.
[505]12;
[376]13; This program is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[505]16; GNU General Public License for more details.
[376]17; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
18;
[41]19
20CURRENTDIR_CHARACTERS EQU 002Eh
21UPDIR_CHARACTERS EQU 2E2Eh
22
23; Section containing code
24SECTION .text
25
26;--------------------------------------------------------------------
27; DialogFile_GetFileNameWithIoInDSSI
28; Parameters:
29; DS:SI: Ptr to FILE_DIALOG_IO
30; SS:BP: Ptr to parent MENU
31; Returns:
32; Nothing
33; Corrupts registers:
34; AX, BX, CX, DX, SI, DI
35;--------------------------------------------------------------------
36ALIGN JUMP_ALIGN
37DialogFile_GetFileNameWithIoInDSSI:
38 mov bx, FileEventHandler
39 mov BYTE [si+FILE_DIALOG_IO.bUserCancellation], TRUE
40 jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX
41
42
43;--------------------------------------------------------------------
44; FileEventHandler
45; Common parameters for all events:
46; BX: Menu event (anything from MENUEVENT struct)
47; SS:BP: Ptr to DIALOG
48; Common return values for all events:
49; CF: Set if event processed
50; Cleared if event not processed
51; Corrupts registers:
52; All
53;--------------------------------------------------------------------
54ALIGN JUMP_ALIGN
55FileEventHandler:
56 jmp [cs:bx+.rgfnEventHandlers]
57
58
59ALIGN JUMP_ALIGN
60.ItemSelectedFromCX:
61 call LoadItemStringBufferToESDI
[106]62 call Registers_CopyESDItoDSSI
[52]63 call ItemLineSplitter_GetLineToDSSIandLengthToCXfromStringInDSSIwithIndexInCX
[41]64 jmp ParseSelectionFromItemLineInDSSI
65
66
67ALIGN JUMP_ALIGN
68.RefreshInformation:
69 call GetInfoLinesToCXandDialogFlagsToAX
70 mov si, [cs:.rgszInfoStringLookup]
71 xor bx, bx
72 xchg dx, ax
73ALIGN JUMP_ALIGN
74.InfoLineLoop:
75 shr dl, 1
76 jnc SHORT .CheckNextFlag
77 mov si, [cs:bx+.rgszInfoStringLookup]
78 push bx
79 CALL_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
80 pop bx
81ALIGN JUMP_ALIGN
82.CheckNextFlag:
83 inc bx
84 inc bx
85 loop .InfoLineLoop
86 stc ; Event processed
87 ret
88
89
[53]90ALIGN JUMP_ALIGN
91.RefreshItemFromCX:
92 call LoadItemStringBufferToESDI
93 mov ax, FILE_STRING_LENGTH
94 xchg ax, cx
95 mul cx
96 add di, ax
97 mov si, di
98 mov bx, es
99 dec cx ; Do not print LF at the end of file string
100 CALL_DISPLAY_LIBRARY PrintCharBufferFromBXSIwithLengthInCX
101 stc
102 ret
103
104
[41]105ALIGN WORD_ALIGN
106.rgszInfoStringLookup:
107 dw g_szChangeDrive
108 dw g_szSelectDirectory
109 dw g_szCreateNew
110
111.rgfnEventHandlers:
112istruc MENUEVENT
113 at MENUEVENT.InitializeMenuinitFromDSSI, dw InitializeMenuinitFromSSBP
[58]114 at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
[41]115 at MENUEVENT.IdleProcessing, dw Dialog_EventNotHandled
116 at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled
117 at MENUEVENT.ItemSelectedFromCX, dw .ItemSelectedFromCX
118 at MENUEVENT.KeyStrokeInAX, dw HandleFunctionKeyFromAH
119 at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle
120 at MENUEVENT.RefreshInformation, dw .RefreshInformation
[53]121 at MENUEVENT.RefreshItemFromCX, dw .RefreshItemFromCX
[41]122iend
123
124
125;--------------------------------------------------------------------
[54]126; ReInitializeMenuinitFromSSBP
[41]127; InitializeMenuinitFromSSBP
128; Parameters:
129; SS:BP: Ptr to DIALOG
130; Returns:
131; Nothing
132; Corrupts registers:
133; All, except BP
134;--------------------------------------------------------------------
135ALIGN JUMP_ALIGN
[54]136ReInitializeMenuinitFromSSBP:
137 call DisplayLoadingMessageInInformationArea
[41]138InitializeMenuinitFromSSBP:
139 call LoadItemStringBufferToESDI
140 call CreateStringFromCurrentDirectoryContentsToESDI
[46]141 call LoadItemStringBufferToESDI
142 call SortDirectoryContentsStringFromESDIwithCountInCX
[53]143 call RemoveLastLFandTerminateESDIwithNull
[54]144
[106]145 call Registers_CopySSBPtoDSSI
[52]146 xor ax, ax
147 call Dialog_EventInitializeMenuinitFromDSSIwithHighlightedItemInAX
[41]148 call GetInfoLinesToCXandDialogFlagsToAX
149 mov [bp+MENUINIT.bInfoLines], cl
150 CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
151 mov [bp+MENUINIT.bHeight], ah ; Always max height
[52]152 mov WORD [bp+MENU.wFirstVisibleItem], 0
[41]153 ret
154
155
156;--------------------------------------------------------------------
157; LoadItemStringBufferToESDI
158; Parameters:
159; SS:BP: Ptr to DIALOG
160; Returns:
161; ES:DI: Ptr to item string buffer
162; Corrupts registers:
163; Nothing
164;--------------------------------------------------------------------
165ALIGN JUMP_ALIGN
166LoadItemStringBufferToESDI:
167 les di, [bp+DIALOG.fpDialogIO]
168 les di, [es:di+FILE_DIALOG_IO.fszItemBuffer]
169 ret
170
171
172;--------------------------------------------------------------------
173; CreateStringFromCurrentDirectoryContentsToESDI
174; Parameters:
175; ES:DI: Buffer where to create item string
176; SS:BP: Ptr to DIALOG
177; Returns:
[46]178; CX: Number of files or directories found
[41]179; Corrupts registers:
[53]180; AX, BX, DX, SI, DI, DS
[41]181;--------------------------------------------------------------------
182ALIGN JUMP_ALIGN
183CreateStringFromCurrentDirectoryContentsToESDI:
[53]184 mov bx, di
185 CALL_DISPLAY_LIBRARY PushDisplayContext
186 mov cx, -1
187 CALL_DISPLAY_LIBRARY PrepareOffScreenBufferInESBXwithLengthInCX ; ES:DI now points to buffer
188
[41]189 lds si, [bp+DIALOG.fpDialogIO]
[293]190 eMOVZX cx, [si+FILE_DIALOG_IO.bFileAttributes]
[41]191 lds si, [si+FILE_DIALOG_IO.fpFileFilterString]
192 call Directory_UpdateDTAForFirstMatchForDSSIwithAttributesInCX
[53]193
[41]194 call .ClearDLifInRootDirectory
195 call Directory_GetDiskTransferAreaAddressToDSSI
[46]196 xor cx, cx ; Clear file/directory count
[53]197 call .FindMatchingFilesAndPrintThemToOffScreenBuffer
[41]198
[505]199 JMP_DISPLAY_LIBRARY PopDisplayContext
[41]200
201;--------------------------------------------------------------------
202; .ClearDLifInRootDirectory
203; Parameters:
204; SS:BP: Ptr to DIALOG
205; ES:DI: Ptr to destination string buffer
206; Returns:
207; DL: Cleared if in root directory
208; Set if in any other directory
209; Corrupts registers:
210; AX, SI, DS
211;--------------------------------------------------------------------
212ALIGN JUMP_ALIGN
213.ClearDLifInRootDirectory:
[106]214 call Registers_CopyESDItoDSSI
[41]215 call Directory_WriteCurrentPathToDSSI
216 mov dl, [si]
217 ret
218
219;--------------------------------------------------------------------
[53]220; .FindMatchingFilesAndPrintThemToOffScreenBuffer
[41]221; Parameters:
[53]222; CX: Initial directory count
223; DL: Zero if root directory selected
224; DS:SI: Ptr to DTA with first matching file
[41]225; Returns:
[53]226; CX: Incremented by number of files/directories found
[41]227; Corrupts registers:
[53]228; AX, BX, DX, DI, DS
[41]229;--------------------------------------------------------------------
230ALIGN JUMP_ALIGN
[53]231.FindMatchingFilesAndPrintThemToOffScreenBuffer:
232 call AppendFileFromDTAinDSSItoOffScreenBuffer
233 call Directory_UpdateDTAForNextMatchUsingPreviousParameters
234 jnc SHORT .FindMatchingFilesAndPrintThemToOffScreenBuffer
[41]235 ret
236
[46]237
[41]238;--------------------------------------------------------------------
[53]239; AppendFileFromDTAinDSSItoOffScreenBuffer
[41]240; Parameters:
[46]241; CX: Files/directores found
[41]242; DL: Zero if root directory selected
243; DS:SI: Ptr to DTA containing file information
244; Returns:
[46]245; CX: Incremented by number of files/directories found
[41]246; Corrupts registers:
[53]247; AX, BX
[41]248;--------------------------------------------------------------------
249ALIGN JUMP_ALIGN
[53]250AppendFileFromDTAinDSSItoOffScreenBuffer:
[41]251 call .FilterCurrentDirectory ; We never want "."
252 call .FilterUpDirectoryWhenInRoot ; No ".." when in root directory
[46]253 inc cx ; Nothing filtered so increment files/directories
[41]254
255 push bp
256 push si
[53]257 push dx
[46]258 push cx
[41]259 call .FormatFileOrDirectoryToBufferFromDTAinDSSI
[46]260 pop cx
[53]261 pop dx
[41]262 pop si
263 pop bp
264 ret
265
266;--------------------------------------------------------------------
[53]267; .FilterCurrentDirectory
268; .FilterUpDirectoryWhenInRoot
269; Parameters:
270; DL: Zero if root directory selected
271; DS:SI: Ptr to DTA containing file information
272; Returns:
273; Nothing
274; Returns from AppendFileToBufferInESDIfromDtaInDSSI when filtering
275; Corrupts registers:
276; AX
277;--------------------------------------------------------------------
278ALIGN JUMP_ALIGN
279.FilterCurrentDirectory:
280 cmp WORD [si+DTA.szFile], CURRENTDIR_CHARACTERS
[181]281 je SHORT .DoFilter
[53]282 ret
283
284ALIGN JUMP_ALIGN
285.FilterUpDirectoryWhenInRoot:
286 test dl, dl ; Set ZF if root directory selected
287 jnz SHORT .ReturnWithoutFiltering
288 cmp WORD [si+DTA.szFile], UPDIR_CHARACTERS
289 jne SHORT .ReturnWithoutFiltering
[181]290.DoFilter:
[53]291 add sp, BYTE 2 ; Remove return address from stack
292ALIGN JUMP_ALIGN, ret
293.ReturnWithoutFiltering:
294 ret
295
296;--------------------------------------------------------------------
[41]297; .FormatFileOrDirectoryToBufferFromDTAinDSSI
298; Parameters:
299; DS:SI: Ptr to DTA containing file information
300; Returns:
301; Nothing
302; Corrupts registers:
303; AX, BX, CX, DX, SI, DI, BP
304;--------------------------------------------------------------------
305ALIGN JUMP_ALIGN
306.FormatFileOrDirectoryToBufferFromDTAinDSSI:
307 mov bp, sp
308 lea ax, [si+DTA.szFile]
309
310 test BYTE [si+DTA.bFileAttributes], FLG_FILEATTR_DIRECTORY
311 jnz SHORT .FormatDirectory
[46]312 ; Fall to .FormatFile
[41]313
[46]314;--------------------------------------------------------------------
315; .FormatFile
316; Parameters:
317; BP: SP before pushing formatting parameters
318; DS:AX: Far pointer to file name
319; DS:SI: Ptr to DTA containing file information
320; Returns:
321; Nothing
322; Corrupts registers:
[53]323; AX, BX, CX, DX, SI, DI
[46]324;--------------------------------------------------------------------
325.FormatFile:
326 xchg si, ax
[53]327 call String_ConvertDSSItoLowerCase
[46]328 xchg ax, si
[52]329
330 ; Push parameters for file name
[53]331 push ax ; Push file name offset
332 push ds ; Push file name segment
[46]333
334 ; Push parameters for file size
[41]335 mov ax, [si+DTA.dwFileSize]
336 mov dx, [si+DTA.dwFileSize+2]
337 xor bx, bx
338 xor cx, cx
339 call Size_GetSizeToAXAndCharToDLfromBXDXAXwithMagnitudeInCX
340 mov cl, 'i'
341 cmp dl, ' '
342 eCMOVE cl, dl
343 push ax
344 push dx
345 push cx
[46]346
347 ; Format to buffer
[41]348 mov si, g_szFileFormat
349 jmp SHORT .FormatStringInCSSIandReturn
350
[46]351;--------------------------------------------------------------------
352; .FormatDirectory
353; Parameters:
354; BP: SP before pushing formatting parameters
355; DS:AX: Far pointer to directory name
356; DS:SI: Ptr to DTA containing file information
357; Returns:
358; Nothing
359; Corrupts registers:
[53]360; AX, SI, DI
[46]361;--------------------------------------------------------------------
[41]362ALIGN JUMP_ALIGN
363.FormatDirectory:
[46]364 push ax ; Push directory name offset
365 push ds ; Push directory name segment
[41]366 mov ax, g_szSub
367 cmp WORD [si+DTA.szFile], UPDIR_CHARACTERS
368 eCMOVE ax, g_szUp
369 push ax
370 mov si, g_szDirectoryFormat
371ALIGN JUMP_ALIGN
372.FormatStringInCSSIandReturn:
[505]373 JMP_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
[41]374
375
376;--------------------------------------------------------------------
[46]377; SortDirectoryContentsStringFromESDIwithCountInCX
378; Parameters:
379; CX: Number of files and directories
380; ES:DI: Buffer containing directory contents string
381; SS:BP: Ptr to DIALOG
382; Returns:
[53]383; ES:DI: Ptr to end of directory contents string
[46]384; Corrupts registers:
[53]385; AX, BX, CX, DX, SI, DS
[46]386;--------------------------------------------------------------------
387ALIGN JUMP_ALIGN
388SortDirectoryContentsStringFromESDIwithCountInCX:
[106]389 call Registers_CopyESDItoDSSI
[46]390
[181]391 ; Add directory contents string length to DI
[53]392 mov ax, FILE_STRING_LENGTH
[181]393 push ax
[53]394 mul cx
395 add di, ax
396
[181]397 mov dx, cx
398 pop cx
399 mov bx, .FileStringComparator
400 jmp Sort_ItemsFromDSSIwithCountInDXsizeInCXandComparatorInBX
401
[46]402;--------------------------------------------------------------------
403; .FileStringComparator
404; Parameters:
405; CX: Item size in bytes
406; DS:SI: Ptr to first item to compare
407; ES:DI: Ptr to second item to compare
408; Returns:
[181]409; FLAGS: Signed comparison between first and second item
[46]410; Corrupts registers:
411; Nothing
412;--------------------------------------------------------------------
413ALIGN JUMP_ALIGN
414.FileStringComparator:
415 push di
416 push si
417 push cx
418 push bx
419
420 mov bx, FILE_STRING_LENGTH-2 ; Zero BH
421 cmp WORD [si], UPDIR_CHARACTERS
422 je SHORT .ForceValueFromDSSItoBeLess
423 mov bl, [si+bx]
424 cmp bl, [es:di+FILE_STRING_LENGTH-2] ; 'B' for files, 'R' for directories
425 jne SHORT .ForceValueFromDSSItoBeMoreOrLess
426 repe cmpsb ; Two directories or two files
427
428ALIGN JUMP_ALIGN
429.ReturnFromComparison:
430 pop bx
431 pop cx
432 pop si
433 pop di
434 ret
435ALIGN JUMP_ALIGN
436.ForceValueFromDSSItoBeMoreOrLess:
437 ja SHORT .ForceValueFromDSSItoBeLess ; Directory in SI, file in DI
438 xchg bl, bh
439 ; Fall to ForceValueFromDSSItoBeLess
440ALIGN JUMP_ALIGN
441.ForceValueFromDSSItoBeLess:
442 cmp bh, bl
443 jmp SHORT .ReturnFromComparison
444
445
446;--------------------------------------------------------------------
[54]447; RemoveLastLFandTerminateESDIwithNull
448; Parameters:
449; ES:DI: Ptr to end of buffer to terminate
450; Returns:
451; Nothing
452; Corrupts registers:
453; AX
454;--------------------------------------------------------------------
455ALIGN JUMP_ALIGN
456RemoveLastLFandTerminateESDIwithNull:
457 dec di
458 xor ax, ax
459 stosb
460 ret
461
462
463;--------------------------------------------------------------------
[41]464; GetInfoLinesToCXandDialogFlagsToAX
465; Parameters:
466; SS:BP: Ptr to DIALOG
467; Returns:
468; AX: Dialog flags
469; CX: Number of info lines to be displayed
470; Corrupts registers:
471; SI, DS
472;--------------------------------------------------------------------
473ALIGN JUMP_ALIGN
474GetInfoLinesToCXandDialogFlagsToAX:
475 xor ax, ax
476 call GetDialogFlagsToAL
477 jmp Bit_GetSetCountToCXfromAX
478
479;--------------------------------------------------------------------
480; GetDialogFlagsToAL
481; Parameters:
482; SS:BP: Ptr to DIALOG
483; Returns:
484; AL: Dialog flags
485; Corrupts registers:
486; SI, DS
487;--------------------------------------------------------------------
488ALIGN JUMP_ALIGN
489GetDialogFlagsToAL:
490 lds si, [bp+DIALOG.fpDialogIO]
491 mov al, [si+FILE_DIALOG_IO.bDialogFlags]
492 ret
493
494
495;--------------------------------------------------------------------
496; ParseSelectionFromItemLineInDSSI
497; Parameters:
498; DS:SI: Ptr to char buffer containing file or directory to be selected
499; SS:BP: Ptr to DIALOG
500; Returns:
501; Nothing
502; Corrupts registers:
503; All, except BP
504;--------------------------------------------------------------------
505ALIGN JUMP_ALIGN
506ParseSelectionFromItemLineInDSSI:
[46]507 mov ax, [si]
508 cmp ax, UPDIR_CHARACTERS
509 je SHORT .ChangeToUpdir
510 call Char_IsUpperCaseLetterInAL
511 jc SHORT .ParseAndChangeToSubdirInDSSI
[141]512 call Char_IsDecimalDigitInAL
513 jc SHORT .ParseAndChangeToSubdirInDSSI ; Assume subdir and check for errors
[46]514 ; Fall to .ParseAndSelectFileFromDSSI
[41]515
516;--------------------------------------------------------------------
[46]517; .ParseAndSelectFileFromDSSI
[41]518; Parameters:
[46]519; DS:SI: NULL terminated string selected from dialog
[41]520; SS:BP: Ptr to DIALOG
521; Returns:
522; Nothing (exits dialog)
523; Corrupts registers:
524; All, except BP
525;--------------------------------------------------------------------
[46]526.ParseAndSelectFileFromDSSI:
[41]527 les di, [bp+DIALOG.fpDialogIO]
528 add di, BYTE FILE_DIALOG_IO.szFile
529 mov cx, FILENAME_BUFFER_SIZE-1
[50]530 call Memory_CopyCXbytesFromDSSItoESDI
[41]531 xor ax, ax
532 stosb ; Terminate with NULL
[293]533 jmp SHORT CloseFileDialogAfterSuccessfulSelection
[41]534
535;--------------------------------------------------------------------
[46]536; .ChangeToUpdir
[41]537; Parameters:
538; SS:BP: Ptr to DIALOG
539; Returns:
540; Nothing
541; Corrupts registers:
542; All, except BP
543;--------------------------------------------------------------------
544ALIGN JUMP_ALIGN
[46]545.ChangeToUpdir:
[51]546 push cs
547 pop ds
[46]548 mov si, g_szUpdir
549 jmp SHORT .ChangeDirectoryToDSSI
550
551;--------------------------------------------------------------------
552; .ParseAndChangeToSubdirInDSSI
553; Parameters:
554; DS:SI: NULL terminated string selected from dialog
555; SS:BP: Ptr to DIALOG
556; Returns:
557; Nothing
558; Corrupts registers:
559; All, except BP
560;--------------------------------------------------------------------
561ALIGN JUMP_ALIGN
562.ParseAndChangeToSubdirInDSSI:
563 mov BYTE [si+12], NULL ; Terminate with NULL (unnecessary spaces do not matter)
564.ChangeDirectoryToDSSI:
[41]565 call Directory_ChangeToPathFromDSSI
[141]566 jc SHORT .ParseAndSelectFileFromDSSI ; Must have been a file starting with number
[41]567 ; Fall to RefreshFilesToDisplay
568
569;--------------------------------------------------------------------
570; RefreshFilesToDisplay
571; Parameters:
572; SS:BP: Ptr to DIALOG
573; Returns:
574; Nothing
575; Corrupts registers:
576; All, except BP
577;--------------------------------------------------------------------
578ALIGN JUMP_ALIGN
579RefreshFilesToDisplay:
[54]580 call ReInitializeMenuinitFromSSBP
[41]581 jmp MenuInit_RefreshMenuWindow
582
583
584;--------------------------------------------------------------------
585; HandleFunctionKeyFromAH
586; Parameters:
587; AH: Scancode for function key
588; SS:BP: Ptr to DIALOG
589; Returns:
590; Nothing
591; Corrupts registers:
592; AX, SI, DI, BP
593;--------------------------------------------------------------------
594ALIGN JUMP_ALIGN
595HandleFunctionKeyFromAH:
596 call GetDialogFlagsToAL
597 cmp ah, KEY_FILEDIALOG_NEW_FILE_OR_DIR
598 je SHORT HandleFunctionKeyForCreatingNewFileOrDirectory
599 cmp ah, KEY_FILEDIALOG_SELECT_DIRECTORY
600 je SHORT HandleFunctionKeyForSelectingDirectoryInsteadOfFile
601 cmp ah, KEY_FILEDIALOG_CHANGE_DRIVE
602 je SHORT HandleFunctionKeyForDriveChange
603ReturnWithoutHandlingKeystroke:
604 clc ; Event not processed
605 ret
606
607
608;--------------------------------------------------------------------
609; HandleFunctionKeyForCreatingNewFileOrDirectory
610; Parameters:
611; AL: File dialog flags
612; SS:BP: Ptr to DIALOG
613; Returns:
614; Closes file dialog
615; Corrupts registers:
616; All, except BP
617;--------------------------------------------------------------------
618ALIGN JUMP_ALIGN
619HandleFunctionKeyForCreatingNewFileOrDirectory:
620 test al, FLG_FILEDIALOG_NEW
621 jz SHORT ReturnWithoutHandlingKeystroke
622
623 mov cx, STRING_DIALOG_IO_size
624 call Memory_ReserveCXbytesFromStackToDSSI
625
[568]626;;; InitializeStringDialogIoInDSSIforInputtingFileName
[41]627 call InitializeNullStringsToDialogInputInDSSI
628 mov WORD [si+DIALOG_INPUT.fszTitle], g_szEnterNewFileOrDirectory
629 mov WORD [si+STRING_DIALOG_IO.fnCharFilter], NULL
630 mov WORD [si+STRING_DIALOG_IO.wBufferSize], FILENAME_BUFFER_SIZE
631 les ax, [bp+DIALOG.fpDialogIO]
632 add ax, BYTE FILE_DIALOG_IO.szFile
633 mov [si+STRING_DIALOG_IO.fpReturnBuffer], ax
634 mov [si+STRING_DIALOG_IO.fpReturnBuffer+2], es
[568]635;;;
[41]636
[568]637 CALL_MENU_LIBRARY GetStringWithIoInDSSI
638 mov al, [si+STRING_DIALOG_IO.bUserCancellation]
639 add sp, BYTE STRING_DIALOG_IO_size
640 test al, al ; User cancellation?
641 jnz SHORT ReturnWithoutHandlingKeystroke
642 jmp CloseFileDialogAfterSuccessfulSelection
[41]643
[568]644
[41]645;--------------------------------------------------------------------
646; HandleFunctionKeyForSelectingDirectoryInsteadOfFile
647; Parameters:
648; AL: File dialog flags
649; SS:BP: Ptr to DIALOG
650; Returns:
651; Closes file dialog
652; Corrupts registers:
653; All, except BP
654;--------------------------------------------------------------------
655ALIGN JUMP_ALIGN
656HandleFunctionKeyForSelectingDirectoryInsteadOfFile:
657 test al, FLG_FILEDIALOG_DIRECTORY
658 jz SHORT ReturnWithoutHandlingKeystroke
[293]659 ; Fall to CloseFileDialogAfterSuccessfulSelection
[41]660
661;--------------------------------------------------------------------
[293]662; CloseFileDialogAfterSuccessfulSelection
[41]663; Parameters:
664; SS:BP: Ptr to DIALOG
665; Returns:
666; Nothing (exits dialog)
667; Corrupts registers:
668; All, except BP
669;--------------------------------------------------------------------
670ALIGN JUMP_ALIGN
[293]671CloseFileDialogAfterSuccessfulSelection:
[41]672 lds di, [bp+DIALOG.fpDialogIO]
673 mov BYTE [di+FILE_DIALOG_IO.bUserCancellation], FALSE
674 jmp MenuInit_CloseMenuWindow
675
676
677;--------------------------------------------------------------------
678; HandleFunctionKeyForDriveChange
679; Parameters:
680; AL: File dialog flags
681; SS:BP: Ptr to DIALOG
682; Returns:
683; Nothing
684; Corrupts registers:
685; All, except BP
686;--------------------------------------------------------------------
687ALIGN JUMP_ALIGN
688HandleFunctionKeyForDriveChange:
689 test al, FLG_FILEDIALOG_DRIVES
690 jz SHORT ReturnWithoutHandlingKeystroke
691
[54]692 call DisplayLoadingMessageInInformationArea
693 mov cx, DRIVE_DIALOG_IO_size
694 call Memory_ReserveCXbytesFromStackToDSSI
695 call .DisplayDriveSelectionDialogWithIoInDSSI
696 call .ChangeDriveToUserSelectionFromIoInDSSI
697 add sp, BYTE DRIVE_DIALOG_IO_size
698 ret
[41]699
700;--------------------------------------------------------------------
[54]701; .DisplayDriveSelectionDialogWithIoInDSSI
[41]702; Parameters:
[54]703; DS:SI: Ptr to uninitialized DRIVE_DIALOG_IO
[41]704; SS:BP: Ptr to DIALOG
705; Returns:
[54]706; DS:SI: Ptr to DRIVE_DIALOG_IO
[41]707; Corrupts registers:
[54]708; AX, DI
[41]709;--------------------------------------------------------------------
710ALIGN JUMP_ALIGN
[54]711.DisplayDriveSelectionDialogWithIoInDSSI:
[41]712 call InitializeNullStringsToDialogInputInDSSI
713 mov WORD [si+DIALOG_INPUT.fszTitle], g_szSelectNewDrive
[525]714 JMP_MENU_LIBRARY GetDriveWithIoInDSSI
[41]715
716;--------------------------------------------------------------------
[54]717; .ChangeDriveToUserSelectionFromIoInDSSI
[41]718; Parameters:
[54]719; DS:SI: Ptr to DRIVE_DIALOG_IO
[41]720; SS:BP: Ptr to DIALOG
721; Returns:
722; Nothing
723; Corrupts registers:
[54]724; All, except BP
[41]725;--------------------------------------------------------------------
726ALIGN JUMP_ALIGN
[54]727.ChangeDriveToUserSelectionFromIoInDSSI:
728 cmp BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], FALSE
729 jne SHORT .UserCancelledDriveChange
[41]730
[54]731 mov dl, [si+DRIVE_DIALOG_IO.bReturnDriveNumber]
732 call Drive_SetDefaultFromDL
733 jmp RefreshFilesToDisplay
734.UserCancelledDriveChange:
[41]735 ret
736
737
738;--------------------------------------------------------------------
[54]739; DisplayLoadingMessageInInformationArea
[53]740; Parameters:
[54]741; SS:BP: Ptr to DIALOG
[53]742; Returns:
743; Nothing
744; Corrupts registers:
[54]745; AX, BX, CX, DX, SI, DI
[53]746;--------------------------------------------------------------------
747ALIGN JUMP_ALIGN
[54]748DisplayLoadingMessageInInformationArea:
749 call MenuText_ClearInformationArea
750 call MenuText_PrepareToDrawInformationArea
751 mov si, g_szLoadingPleaseWait
[505]752 JMP_DISPLAY_LIBRARY PrintNullTerminatedStringFromCSSI
[53]753
754
755;--------------------------------------------------------------------
[41]756; InitializeNullStringsToDialogInputInDSSI
757; Parameters:
758; DS:SI: Ptr to DIALOG_INPUT
759; SS:BP: Ptr to DIALOG
760; Returns:
761; Nothing
762; Corrupts registers:
763; AX
764;--------------------------------------------------------------------
765ALIGN JUMP_ALIGN
766InitializeNullStringsToDialogInputInDSSI:
767 mov ax, g_szNull
768 mov [si+DIALOG_INPUT.fszTitle], ax
769 mov [si+DIALOG_INPUT.fszTitle+2], cs
770 mov [si+DIALOG_INPUT.fszItems], ax
771 mov [si+DIALOG_INPUT.fszItems+2], cs
772 mov [si+DIALOG_INPUT.fszInfo], ax
773 mov [si+DIALOG_INPUT.fszInfo+2], cs
774 ret
Note: See TracBrowser for help on using the repository browser.