VError VProjectItemFolder::_MoveTo(const VFolder& srcFolder, VFolder& destFolder) { VError err = VE_OK; if (!destFolder.Exists()) err = destFolder.CreateRecursive(); else err = VE_UNKNOWN_ERROR; // TO DO ce n'est pas vrai : mais c'est pour le moment : 011008 // que faire : ecraser, fusionner, on attends les specs ! if (err == VE_OK) { for (VFolderIterator it_folder(&srcFolder, FI_WANT_FOLDERS | FI_WANT_INVISIBLES); it_folder.IsValid() && err == VE_OK; ++it_folder) { VFolder srcNewFolder(it_folder.Current()->GetPath()); VString srcNewFolderName; srcNewFolder.GetName(srcNewFolderName); VString destNewFolderPath; destFolder.GetPath(destNewFolderPath); destNewFolderPath += srcNewFolderName; destNewFolderPath += FOLDER_SEPARATOR; VFolder destNewFolder(destNewFolderPath); err = _MoveTo(srcNewFolder, destNewFolder); } for (VFileIterator it_file(&srcFolder, FI_WANT_FILES | FI_WANT_INVISIBLES); it_file.IsValid() && err == VE_OK; ++it_file) { VFile srcNewFile(it_file.Current()->GetPath()); VString srcNewFileName; srcNewFile.GetName(srcNewFileName); VString destNewFilePath; destFolder.GetPath(destNewFilePath); destNewFilePath += srcNewFileName; VFile destNewFile(destNewFilePath); VProjectItemFile projectItemFile; VURL srcURL = VURL(srcNewFile.GetPath()); VURL destURL = VURL(destNewFile.GetPath()); projectItemFile.MoveTo(srcURL, destURL); } } if (err == VE_OK) { err = srcFolder.Delete(true); } return err; }
bool VProjectItemFolder::MoveTo(const XBOX::VURL& inSrcURL,const XBOX::VURL& inDestURL) { bool ok = false; VFilePath srcFilePath, destFilePath; inSrcURL.GetFilePath(srcFilePath); inDestURL.GetFilePath(destFilePath); VFolder srcFolder(srcFilePath); VFolder destFolder(destFilePath); if (_MoveTo(srcFolder, destFolder) == VE_OK) ok = true; return ok; }
/** * Call this function periodically outside the interrupt context to process commands */ void Command_Task() { if(CommandStatus != CommandStateFinishedReceiving) return; LED_GREEN_ClrVal(); CommandStatus = CommandStateExecuting; uint32 intendedAddress = 0; // this is the address the packet is intended for // uint32 intendedAddress = ( (uint32)ReceiveBuffer[1] << 24 ) | ( (uint32)ReceiveBuffer[2] << 16 ) | ( (uint32)ReceiveBuffer[3] << 8 ) | (uint32)ReceiveBuffer[4]; // intendedAddress = (intendedAddress << 8) + ReceiveBuffer[4]; // intendedAddress = (intendedAddress << 8) + ReceiveBuffer[3]; // intendedAddress = (intendedAddress << 8) + ReceiveBuffer[2]; // intendedAddress = (intendedAddress << 8) + ReceiveBuffer[1]; intendedAddress |= ReceiveBuffer[4] & 0xFF; intendedAddress <<= 8; intendedAddress |= ReceiveBuffer[3] & 0xFF; intendedAddress <<= 8; intendedAddress |= ReceiveBuffer[2] & 0xFF; intendedAddress <<= 8; intendedAddress |= ReceiveBuffer[1] & 0xFF; if(intendedAddress == MyAddress || intendedAddress == 0) // 0 = broadcast { switch(ReceiveBuffer[5]) { case CommandPing: _Ping(); break; case CommandConfigure: _Configure(&ReceiveBuffer[6]); break; case CommandHomeUp: //_HomeUp(); break; case CommandHomeDown: //_HomeDown(); break; case CommandMoveTo: _MoveTo(&ReceiveBuffer[6]); break; case CommandGetStatus: _GetStatus(); break; case CommandAssociate: _Associate(); break; case CommandIdentifyLed: _IdentifyLed(ReceiveBuffer[6]); break; case CommandJog: _Jog(&ReceiveBuffer[6]); break; case CommandResetCounters: _ResetCounter(ReceiveBuffer[6], ReceiveBuffer[7]); break; case CommandDoubleMoveTo: _DoubleMoveTo(&ReceiveBuffer[6]); break; case CommandSetPosGetData: _SetPosGetData(&ReceiveBuffer[6]); break; case CommandGetHallPos: _GetHallPos(); break; case CommandGetPots: _GetPots(); break; case CommandGetCurremt: _GetCurrent(); break; } } CommandStatus = CommandStateWaiting; LED_GREEN_SetVal(); }
void CCodeView::OnPaint(wxPaintEvent& event) { // -------------------------------------------------------------------- // General settings // ------------------------- wxPaintDC dc(this); wxRect rc = GetClientRect(); dc.SetFont(DebuggerFont); wxCoord w,h; dc.GetTextExtent(_T("0WJyq"),&w,&h); if (h > rowHeight) rowHeight = h; dc.GetTextExtent(_T("W"),&w,&h); int charWidth = w; struct branch { int src, dst, srcAddr; }; branch branches[256]; int numBranches = 0; // TODO: Add any drawing code here... int width = rc.width; int numRows = (rc.height / rowHeight) / 2 + 2; // ------------ // -------------------------------------------------------------------- // Colors and brushes // ------------------------- dc.SetBackgroundMode(wxTRANSPARENT); // the text background const wxChar* bgColor = _T("#ffffff"); wxPen nullPen(bgColor); wxPen currentPen(_T("#000000")); wxPen selPen(_T("#808080")); // gray nullPen.SetStyle(wxTRANSPARENT); currentPen.SetStyle(wxSOLID); wxBrush currentBrush(_T("#FFEfE8")); // light gray wxBrush pcBrush(_T("#70FF70")); // green wxBrush bpBrush(_T("#FF3311")); // red wxBrush bgBrush(bgColor); wxBrush nullBrush(bgColor); nullBrush.SetStyle(wxTRANSPARENT); dc.SetPen(nullPen); dc.SetBrush(bgBrush); dc.DrawRectangle(0, 0, 16, rc.height); dc.DrawRectangle(0, 0, rc.width, 5); // ------------ // -------------------------------------------------------------------- // Walk through all visible rows // ------------------------- for (int i = -numRows; i <= numRows; i++) { unsigned int address = curAddress + i * align; int rowY1 = rc.height / 2 + rowHeight * i - rowHeight / 2; int rowY2 = rc.height / 2 + rowHeight * i + rowHeight / 2; wxString temp = wxString::Format(_T("%08x"), address); u32 col = debugger->GetColor(address); wxBrush rowBrush(wxColor(col >> 16, col >> 8, col)); dc.SetBrush(nullBrush); dc.SetPen(nullPen); dc.DrawRectangle(0, rowY1, 16, rowY2 - rowY1 + 2); if (selecting && (address == selection)) dc.SetPen(selPen); else dc.SetPen(i == 0 ? currentPen : nullPen); if (address == debugger->GetPC()) dc.SetBrush(pcBrush); else dc.SetBrush(rowBrush); dc.DrawRectangle(16, rowY1, width, rowY2 - rowY1 + 1); dc.SetBrush(currentBrush); if (!plain) { dc.SetTextForeground(_T("#600000")); // the address text is dark red dc.DrawText(temp, 17, rowY1); dc.SetTextForeground(_T("#000000")); } // If running if (debugger->IsAlive()) { char dis[256]; debugger->Disassemble(address, dis, 256); char* dis2 = strchr(dis, '\t'); char desc[256] = ""; // If we have a code if (dis2) { *dis2 = 0; dis2++; // look for hex strings to decode branches const char* mojs = strstr(dis2, "0x8"); if (mojs) { for (int k = 0; k < 8; k++) { bool found = false; for (int j = 0; j < 22; j++) { if (mojs[k + 2] == "0123456789ABCDEFabcdef"[j]) found = true; } if (!found) { mojs = nullptr; break; } } } if (mojs) { int offs; sscanf(mojs + 2, "%08x", &offs); branches[numBranches].src = rowY1 + rowHeight / 2; branches[numBranches].srcAddr = address / align; branches[numBranches++].dst = (int)(rowY1 + ((s64)(u32)offs - (s64)(u32)address) * rowHeight / align + rowHeight / 2); sprintf(desc, "-->%s", debugger->GetDescription(offs).c_str()); dc.SetTextForeground(_T("#600060")); // the -> arrow illustrations are purple } else { dc.SetTextForeground(_T("#000000")); } dc.DrawText(StrToWxStr(dis2), 17 + 17*charWidth, rowY1); // ------------ } // Show blr as its' own color if (strcmp(dis, "blr")) dc.SetTextForeground(_T("#007000")); // dark green else dc.SetTextForeground(_T("#8000FF")); // purple dc.DrawText(StrToWxStr(dis), 17 + (plain ? 1*charWidth : 9*charWidth), rowY1); if (desc[0] == 0) { strcpy(desc, debugger->GetDescription(address).c_str()); } if (!plain) { dc.SetTextForeground(_T("#0000FF")); // blue //char temp[256]; //UnDecorateSymbolName(desc,temp,255,UNDNAME_COMPLETE); if (strlen(desc)) { dc.DrawText(StrToWxStr(desc), 17 + 35 * charWidth, rowY1); } } // Show red breakpoint dot if (debugger->IsBreakpoint(address)) { dc.SetBrush(bpBrush); dc.DrawRectangle(2, rowY1 + 1, 11, 11); } } } // end of for // ------------ // -------------------------------------------------------------------- // Colors and brushes // ------------------------- dc.SetPen(currentPen); for (int i = 0; i < numBranches; i++) { int x = 17 + 49 * charWidth + (branches[i].srcAddr % 9) * 8; _MoveTo(x-2, branches[i].src); if (branches[i].dst < rc.height + 400 && branches[i].dst > -400) { _LineTo(dc, x+2, branches[i].src); _LineTo(dc, x+2, branches[i].dst); _LineTo(dc, x-4, branches[i].dst); _MoveTo(x, branches[i].dst - 4); _LineTo(dc, x-4, branches[i].dst); _LineTo(dc, x+1, branches[i].dst+5); } //else //{ // This can be re-enabled when there is a scrollbar or // something on the codeview (the lines are too long) //_LineTo(dc, x+4, branches[i].src); //_MoveTo(x+2, branches[i].dst-4); //_LineTo(dc, x+6, branches[i].dst); //_LineTo(dc, x+1, branches[i].dst+5); //} //_LineTo(dc, x, branches[i].dst+4); //_LineTo(dc, x-2, branches[i].dst); } // ------------ }
/* Add a sequence of rectangles to this path. */ CStatus CPath_AddRectangles(CPath *_this, CRectangleF *rects, CUInt32 count) { /* ensure we have a this pointer */ CStatus_Require((_this != 0), CStatus_ArgumentNull); /* ensure we have a rectangle list pointer */ CStatus_Require((rects != 0), CStatus_ArgumentNull); /* bail out now if there's nothing to add */ CStatus_Require((count != 0), CStatus_OK); /* add the rectangles */ { /* declarations */ CPointF *p; CByte *t; CFloat left; CFloat top; CFloat right; CFloat bottom; /* get the end of input pointer */ const CRectangleF *const end = (rects + count); /* get the rectangle edges */ left = CRectangle_X(*rects); top = CRectangle_Y(*rects); right = left + CRectangle_Width(*rects); bottom = top + CRectangle_Height(*rects++); /* perform standard startup procedures for new figure additions */ _BeginNew (_this, (count * 4), p, t, left, top); /* complete the first rectangle */ _LineTo(p, t, right, top); _LineTo(p, t, right, bottom); _LineToClose(p, t, left, bottom); /* add the remaining rectangles */ while(rects != end) { /* get the rectangle edges */ left = CRectangle_X(*rects); top = CRectangle_Y(*rects); right = left + CRectangle_Width(*rects); bottom = top + CRectangle_Height(*rects++); /* add the rectangle */ _MoveTo(p, t, left, top); _LineTo(p, t, right, top); _LineTo(p, t, right, bottom); _LineToClose(p, t, left, bottom); } } /* return successfully */ return CStatus_OK; }