Advertisement
Guest User

Untitled

a guest
Nov 4th, 2014
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.72 KB | None | 0 0
  1.  
  2. // $parent - the parent UI layout
  3. // $action - "post" or "query"
  4. // $initialSettings - the initial exporter settings
  5. // $resultCallback - the function to call
  6. //
  7. global proc int ExportThatTimeOptions(  string $parent,
  8.                                         string $action,
  9.                                         string $initialSettings,
  10.                                         string $resultCallback ) {
  11.  
  12.     int $result;
  13.     string $currentOptions;
  14.     string $optionList[];
  15.     string $optionBreakDown[];
  16.     int $index;
  17.  
  18.     // if we need to create the user interface...
  19.     if ($action == "post") {
  20.  
  21.         setParent $parent;
  22.  
  23.         columnLayout -adj true;
  24.         radioButtonGrp
  25.             -l "Time Mode"
  26.             -nrb 2 -cw3 175 75 75
  27.             -la2 "0" "1" timeMode;
  28.         textFieldGrp
  29.             -l "Format String" formatString;
  30.  
  31.         if (size($initialSettings) > 0) {
  32.             tokenize($initialSettings, ";", $optionList);
  33.             for ($index = 0; $index < size($optionList); $index++) {
  34.                 tokenize($optionList[$index], "=", $optionBreakDown);
  35.  
  36.                 if ($optionBreakDown[0] == "m") {
  37.                     if ($optionBreakDown[1] == "0") {
  38.                         radioButtonGrp -e -sl 1 timeMode;
  39.                     } else {
  40.                         radioButtonGrp -e -sl 2 timeMode;
  41.                     }
  42.                 } else if ($optionBreakDown[0] == "strfrmt") {
  43.                     textFieldGrp -e -text $optionBreakDown[1] formatString;
  44.                 }
  45.             }
  46.         }
  47.         $result = 1;
  48.     } else if ($action == "query") {
  49.  
  50.         if (`radioButtonGrp -q -sl timeMode` == 2) {
  51.             $currentOptions = $currentOptions + "m=1";
  52.         } else {
  53.             $currentOptions = $currentOptions + "m=0";
  54.         }
  55.  
  56.         string $frmtString = `textFieldGrp -q -text formatString`;
  57.         if (`size $frmtString` > 1) {
  58.             $currentOptions = $currentOptions + ";strfrmt="+$frmtString;
  59.            
  60.         }
  61.  
  62.         eval($resultCallback+" \""+$currentOptions+"\"");
  63.         $result = 1;
  64.     } else {
  65.         $result = 0;
  66.     }
  67.    
  68.     return $result;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement