Notifications
Clear all

[Closed] Question: On Creating Exporter Dialog

Thanks @Klunk-1 – this should make things easier.

I will delete the output directory and browse button and remove the dialog code which handled them. So in my file open/close handling I will need to derive/append my unique filename from the TCHAR *name parameter.

you’ll find SplitFilename(…) in the sdk is a useful function for chopping up the path, filename and extension.

1 Reply
(@archangel35757)
Joined: 1 year ago

Posts: 0

Thank you very much for your assistance!

So here is the final Export Dialog code:

static INT_PTR CALLBACK ROFFexportOptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) 
   {
   	static ROFFexport *exp = NULL;
   	static ISpinnerControl *toSpin;
   	static ISpinnerControl *fmSpin;
   	Interface *ipCore = GetCOREInterface();	
   	Interval animRange = ipCore->GetAnimRange();
   	int start = animRange.Start() / GetTicksPerFrame();
   	int end = animRange.End() / GetTicksPerFrame();
    
   	SetSpinDragNotify(TRUE); // Activates sending CC_SPINNER_CHANGE messages.
    
   	switch(message) 
   	{
   	case WM_INITDIALOG:
   		exp = (ROFFexport *)lParam;
   		CenterWindow(hWnd,GetParent(hWnd));
   
   		//
   		// Initialize dialog export options
   		//
   
   		CheckDlgButton(hWnd, IDC_NOTES, g_ExportOptions.bNoteTracks);
   		CheckDlgButton(hWnd, IDC_WRITE_ASCII, g_ExportOptions.bWriteASCII);
   		CheckDlgButton(hWnd, IDC_SEGMENT, g_ExportOptions.bExportSegment);
   
   		// Setup the spinner control for the segment_FROM frame#
   		fmSpin = SetupIntSpinner(hWnd, IDC_FROM_FRAME_SPIN, IDC_FROM_FRAME, start, end, g_ExportOptions.nSegFrom);
   		g_ExportOptions.bExportSegment ?  fmSpin->Enable() : fmSpin->Disable();
   		ReleaseISpinner(fmSpin);
   
   		// Setup the spinner control for the segment_TO frame#	
   		toSpin = SetupIntSpinner(hWnd, IDC_TO_FRAME_SPIN, IDC_TO_FRAME , start, end, g_ExportOptions.nSegTo);
   		g_ExportOptions.bExportSegment ?  toSpin->Enable() : toSpin->Disable();
   		ReleaseISpinner(toSpin);
   			
   		break;
    
   	case WM_COMMAND:
   		switch(LOWORD(wParam))
   		{
   		case IDC_SEGMENT:
   			g_ExportOptions.bExportSegment = IsDlgButtonChecked(hWnd, IDC_SEGMENT);
   
   			fmSpin = GetISpinner(GetDlgItem(hWnd ,IDC_FROM_FRAME_SPIN));
   			g_ExportOptions.bExportSegment ? fmSpin->Enable(): fmSpin->Disable();
   			ReleaseISpinner(fmSpin);
   
   			toSpin = GetISpinner(GetDlgItem(hWnd ,IDC_TO_FRAME_SPIN));
   			g_ExportOptions.bExportSegment ? toSpin->Enable(): toSpin->Disable();
   			ReleaseISpinner(toSpin);
   
   			break;
   
   		case IDC_NOTES:
   			g_ExportOptions.bNoteTracks = IsDlgButtonChecked(hWnd, IDC_NOTES);
   
   			// Do something...
   			break;
   
   		case IDC_WRITE_ASCII:
   			g_ExportOptions.bWriteASCII = IsDlgButtonChecked(hWnd, IDC_WRITE_ASCII);
   
   			// Do something...
   			break;
   
   		case IDC_about:	
   			exp->ShowAbout(hWnd);
   			break;
   
   		case IDC_EXPORT:
   			//
   			// Update export options
   			//
   			g_ExportOptions.bExportSegment = IsDlgButtonChecked(hWnd, IDC_SEGMENT);
   			if ( g_ExportOptions.bExportSegment )
   			{
   				fmSpin = GetISpinner(GetDlgItem(hWnd ,IDC_FROM_FRAME_SPIN));
   				g_ExportOptions.nSegFrom = fmSpin->GetIVal();
   				ReleaseISpinner(fmSpin);
   
   				toSpin = GetISpinner(GetDlgItem(hWnd ,IDC_TO_FRAME_SPIN));
   				g_ExportOptions.nSegTo = toSpin->GetIVal();
   				ReleaseISpinner(toSpin);
   			}
   			else
   			{
   				g_ExportOptions.nSegFrom = start; // animation range starting value
   				g_ExportOptions.nSegTo = end; // animation range ending value
   			}
   
   			g_ExportOptions.bNoteTracks = IsDlgButtonChecked(hWnd, IDC_NOTES);
   			g_ExportOptions.bWriteASCII = IsDlgButtonChecked(hWnd, IDC_WRITE_ASCII);
   
   			EndDialog(hWnd, 1); 
   			break;
   
   		case IDC_CANCEL:
   			EndDialog(hWnd, 0);
   			break;
   		}
   		break;
    
   	case CC_SPINNER_CHANGE:
   		switch (LOWORD(wParam)) 
   		{ 
   		case IDC_FROM_FRAME_SPIN:
   			g_ExportOptions.nSegFrom = ((ISpinnerControl *)lParam)->GetIVal();
   			break;
   
   		case IDC_TO_FRAME_SPIN:
   			g_ExportOptions.nSegTo = ((ISpinnerControl *)lParam)->GetIVal();
   			break;
   		}
   		break;
   
   	case WM_CLOSE:
   		EndDialog(hWnd, 0);
   		break;
   
   	default:
   		return FALSE;
    
   	}
   	return TRUE;
   }
Page 3 / 3