Add loadsvg script command, fix ParanoidNumber size limiting*
[ipdf/code.git] / src / debugscript.cpp
index a8bcd78..19b51d7 100644 (file)
@@ -84,6 +84,11 @@ void DebugScript::ParseAction()
        {
                currentAction.type = AT_Quit;
        }
+       else if (actionType == "loadsvg")
+       {
+               currentAction.type = AT_LoadSVG;
+               inp >> currentAction.filename;
+       }
 }
 
 bool DebugScript::Execute(View *view, Screen *scr)
@@ -121,6 +126,19 @@ bool DebugScript::Execute(View *view, Screen *scr)
        case AT_DisableLazyRendering:
                view->SetLazyRendering(false);
                break;
+       case AT_LoadSVG:
+               #ifdef TRANSFORM_OBJECTS_NOT_VIEW
+                       view->Doc().LoadSVG(currentAction.filename, Rect(Real(1)/Real(2),Real(1)/Real(2),Real(1)/Real(800),Real(1)/Real(600))); 
+               #else
+                       Rect & bounds = view->GetBounds();
+                       view->Doc().LoadSVG(currentAction.filename, Rect(bounds.x+bounds.w/Real(2),bounds.y+bounds.h/Real(2),bounds.w/Real(800),bounds.h/Real(600)));
+               #endif
+               currentAction.type = AT_WaitFrame;
+               view->ForceRenderDirty();
+               view->ForceBufferDirty();
+               view->ForceBoundsDirty();
+               currentAction.loops = 0;
+               break;
        default:
                Fatal("Unknown script command in queue.");
        }

UCC git Repository :: git.ucc.asn.au