bool Pathname::CreateFolder(void *security_descriptor) { int begpart = -1; int len = strlen(_fullpath)+1; char *buff = (char *)alloca(len); for (int i = 1;GetPart(i,buff,len,-1);i++) { if (begpart == -1 && _access(buff,0) != 0) begpart = i; if (begpart != -1) { if (begpart == -1) begpart = i; BOOL res = CreateDirectory(buff,(LPSECURITY_ATTRIBUTES)security_descriptor); if (res == FALSE) { for (int j = i;i>= begpart;i--) { GetPart(i,buff,len,-1); RemoveDirectory(buff); } return false; } } } return true; }
// Enforce parts per package void CTinyCadSymbolDoc::SetPartsPerPackage(int p) { if (GetPart() >= p) { m_part = p - 1; } drawingCollection dels; // Find out how many parts in this package drawingIterator it = GetDrawingBegin(); while (it != GetDrawingEnd()) { CDrawingObject *pointer = *it; if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart() >= p) { dels.push_back( pointer ); } ++ it; } // Now perform the deletions it = dels.begin(); while (it != dels.end()) { Delete( *it ); ++ it; } }
// Set which part in the package to edit void CTinyCadSymbolDoc::EditPartInPackage( int p ) { int OldPart = GetPart(); // Get rid of any drawing tool SelectObject(new CDrawEditItem(this)); m_part = p; // Are there any pins selected for this part int innew = FALSE,inold = FALSE; drawingIterator it = GetDrawingBegin(); while (it != GetDrawingEnd()) { CDrawingObject *pointer = *it; if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()==GetPart()) innew = TRUE; if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()==OldPart) inold = TRUE; ++ it; } // Do we need to copy over the pins? if (!innew && inold && Message(IDS_COPYPINS,MB_YESNO | MB_ICONQUESTION)==IDYES) { CDrawPin *NewPin; drawingIterator it = GetDrawingBegin(); while (it != GetDrawingEnd()) { CDrawingObject *pointer = *it; if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()==OldPart) { NewPin = new CDrawPin(this); *NewPin = *((CDrawPin *)pointer); NewPin->SetPart(GetPart()); Add(NewPin); } ++ it; } } Invalidate(); }
void Animation::SetPartSequence(string partName, string sequenceName) { AnimationPart* part = GetPart(partName); if(part != 0) { part->SetSequence(sequenceName); } }
void nsIMAPMessagePartIDArray::RemoveAndFreeAll() { int n = Count(); for (int i = 0; i < n; i++) { nsIMAPMessagePartID *part = GetPart(i); delete part; } Clear(); }
void nsIMAPMessagePartIDArray::RemoveAndFreeAll() { uint32_t n = Length(); for (uint32_t i = 0; i < n; i++) { nsIMAPMessagePartID *part = GetPart(i); delete part; } Clear(); }
void ApiGetPart(DWORD *argv) { if ((argv[MSG_ATTR_ID] & MSG_MAP_MASK) != MSG_ATTR_ROMAP) return; if ((argv[MSG_ATTR_ID] & MSG_ATTR_MASK) == MSG_ATTR_ROMAP || argv[MSG_SIZE_ID] < sizeof(PART_INFO) + 8) { argv[MSG_RES_ID] = FS_ERR_WRONG_ARGS; KUnmapProcAddr((void*)argv[MSG_ADDR_ID], argv); return; } argv[MSG_RES_ID] = GetPart(argv[3], (PART_INFO*)argv[MSG_ADDR_ID]); KUnmapProcAddr((void*)argv[MSG_ADDR_ID], argv); }
bool Pathname::DeleteFolder(int dfFlags) { int bufflen = strlen(_fullpath)+1; char *buff = (char *)alloca(bufflen); /* if (dfFlags & DFRecycleBin) { GetDirectoryWithDriveWLBS(buff,bufflen); SHFILEOPSTRUCT delinfo; delinfo.hwnd = NULL; delinfo.wFunc = FO_DELETE; delinfo.pFrom = GetFullPath(); delinfo.pTo = NULL; delinfo.fFlags = FOF_ALLOWUNDO|FOF_NOCONFIRMATION|FOF_NOERRORUI|((dfFlags & DFRecursive)?0:FOF_NORECURSION)| ((dfFlags & DFShowProgress)?0:FOF_SILENT); delinfo.fAnyOperationsAborted = 0; delinfo.hNameMappings = 0; delinfo.lpszProgressTitle = 0; } else*/ { if (dfFlags & DFRecursive) { bool res = RemoveDirRecursive(GetDirectoryWithDrive(),dfFlags & DFFile?GetFilename():0); if (res == false) return false; } if (dfFlags & DFPath) { if (GetPart(1,buff,bufflen,-1) == false) return false; return RemoveDirectoryFull(*this, 1,buff,bufflen); } else { GetDirectoryWithDriveWLBS(buff,bufflen); return RemoveDirectory(buff) != FALSE; } } return false; }
void PmeStdSolidChamferFeature::Update(void) { PmeThrowExceptionIf<PmeIlligalOperationException>(GetChamferType() != PmeChamferType_Length); PmeThrowExceptionIf<PmeIlligalOperationException>(m_pSelectedEdge == 0); PmeThrowExceptionIf<PmeIlligalOperationException>(m_length != m_value); PmeThrowExceptionIf<PmeIlligalOperationException>(m_length <= 0); PmeThrowExceptionIf<PmeIlligalOperationException>(m_value <= 0); PmeThrowExceptionIf<PmeIlligalOperationException>(GetSelectedEdge()->GetReferenceType() != PmeReferenceType_Brep); PmePart * pPart = GetPart(); ENTITY * pEdge = pPart->GetSelectionManager()->GetBrepFromReference(GetSelectedEdge()); PmeThrowExceptionIf<PmeIlligalOperationException>(strcmp(pEdge->type_name(), "edge") != 0); ENTITY_LIST selectedEdges; selectedEdges.add(pEdge); double leftRange = m_length; API_BEGIN // api_set_int_option("annotations", TRUE); result = api_chamfer_edges(selectedEdges, leftRange); check_outcome(result); if(result.ok()) { PmeSolid * pSolid = pPart->GetExplicitModel()->GetSolid(); SetSolid(pSolid); } // api_clear_annotations(); API_END }
void FeatureSOLIDCreatePatternCirc::ToUG(void) { tag_t feature; tag_t array; Feature * pFeature =(Feature*) (GetPart()->GetFeatureByName(_featurename)); uf_list_p_t feat_list; UF_MODL_ask_list_item(pFeature->_ugFeatList,0,&feature); // UF_CALL(UF_MODL_create_list(&feat_list)); //UF_CALL(UF_MODL_put_list_item(feat_list,feature)); //UF_CALL(UF_MODL_create_circular_iset(0,_ptorg,_ptvec,_patternnumber,_angleincrement, feat_list,&_ugTag)); //UF_ASSEM_iset_array_data_s // array_data; // array_data.array_name = "asdf"; // array_data.template_component= feature; // array_data.array_subtype = UF_ASSEM_circular_array; // array_data.master_component = NULL_TAG; // // UF_CALL(UF_MODL_create_exp_tag("16", &array_data.dimensions[0])); // // UF_CALL(UF_MODL_create_exp_tag("20", &array_data.offsets[0])); // // UF_CALL(UF_ASSEM_create_iset_array(&array_data, &array)); }
//+--------------------------------------------------------------------------- // // Member: CScrollbarController::OnTick // // Synopsis: Handle mouse timer ticks to implement repeated scroll actions // and focus blinking. // // Arguments: id timer event type // // Notes: // //---------------------------------------------------------------------------- HRESULT CScrollbarController::OnTick(UINT id) { // for now, SB_REPEAT_TIMER is the only id we use Assert(id == SB_REPEAT_TIMER); // timer tick snuck through right before we disabled it if(_pLayout == NULL) { return S_OK; } if(id == SB_REPEAT_TIMER) { if(_partPressed != SBP_NONE) { // while paging, thumb may have moved underneath the mouse if(_partPressed==SBP_PREVTRACK || _partPressed==SBP_NEXTTRACK) { LONG contentSize, containerSize, scrollAmount; BOOL fRightToLeft = (_direction==0 && _pDispScroller->IsRightToLeft()); GetScrollInfo(&contentSize, &containerSize, &scrollAmount); _partPressed = GetPart( _direction, _rcScrollbar, _ptMouse, contentSize, containerSize, scrollAmount, _buttonWidth, &_drawInfo, fRightToLeft); if(_partPressed != _partPressedStart) { _partPressed = SBP_NONE; Verify(_pLayout->OpenView()); InvalidatePart( _partPressedStart, _direction, _rcScrollbar, contentSize, containerSize, scrollAmount, _buttonWidth, _pDispScroller, &_drawInfo); return S_OK; } } // // Now that at least one click has come in (to be processed right afterwards) // we set the timer to be the repeat rate. FormsSetTimer( this, ONTICK_METHOD(CScrollbarController, OnTick, ontick), SB_REPEAT_TIMER, GetRepeatRate()); // repeat this scroll action _pLayout->OnScroll(_direction, TranslateSBAction(_partPressed), 0, FALSE, GetRepeatRate()); } } return S_OK; }
//+--------------------------------------------------------------------------- // // Member: CScrollbarController::MouseMove // // Synopsis: Handle mouse move events. // // Arguments: pt new mouse location // // Notes: // //---------------------------------------------------------------------------- void CScrollbarController::MouseMove(const CPoint& pt) { _ptMouse = pt; _pDispScroller->TransformPoint(&_ptMouse, COORDSYS_GLOBAL, COORDSYS_CONTAINER); switch(_partPressedStart) { case SBP_NONE: case SBP_TRACK: AssertSz(FALSE, "unexpected call to CScrollbarController::MouseMoved"); break; case SBP_THUMB: { LONG contentSize = _pDispScroller->GetContentSize()[_direction]; Assert(contentSize >= 0); LONG trackSize = GetTrackSize(_direction, _rcScrollbar, _buttonWidth) - GetThumbSize(_direction, _rcScrollbar, contentSize, _rcScrollbar.Size(_direction), _buttonWidth, &_drawInfo); if(trackSize <= 0) { break; // can't move thumb } // NOTE: we're not currently checking to see if the mouse point // is out of range perpendicular to the scroll bar axis BOOL fRightToLeft = (_direction==0 && _pDispScroller->IsRightToLeft()); LONG trackPos; if(!fRightToLeft) { trackPos = _ptMouse[_direction] - _rcScrollbar[_direction] - GetScaledButtonWidth(_direction, _rcScrollbar, _buttonWidth) - _mouseInThumb; } else { trackPos = _rcScrollbar.right - GetScaledButtonWidth(_direction, _rcScrollbar, _buttonWidth) - _mouseInThumb - _ptMouse.x; } LONG scrollOffset; if(trackPos <= 0) { scrollOffset = 0; } else { contentSize -= _rcScrollbar.Size(_direction); scrollOffset = MulDivQuick(trackPos, contentSize, trackSize); if(fRightToLeft) { scrollOffset = -scrollOffset; } } _pLayout->OnScroll(_direction, SB_THUMBPOSITION, scrollOffset); } break; default: { // find out what the mouse would be pressing in its new location. // If it's not the same as it used to be, invalidate the part. SCROLLBARPART partPressedOld = _partPressed; LONG contentSize, containerSize, scrollAmount; GetScrollInfo(&contentSize, &containerSize, &scrollAmount); _partPressed = GetPart( _direction, _rcScrollbar, _ptMouse, contentSize, containerSize, scrollAmount, _buttonWidth, &_drawInfo, _pDispScroller->IsRightToLeft()); if(_partPressed != _partPressedStart) { _partPressed = SBP_NONE; } if(_partPressed != partPressedOld) { SCROLLBARPART invalidPart = _partPressed; if(_partPressed != SBP_NONE) { // perform scroll action and set timer OnTick(SB_REPEAT_TIMER); } else { invalidPart = partPressedOld; } Verify(_pLayout->OpenView()); InvalidatePart( invalidPart, _direction, _rcScrollbar, contentSize, containerSize, scrollAmount, _buttonWidth, _pDispScroller, &_drawInfo); } } break; } }
//+--------------------------------------------------------------------------- // // Member: CScrollbarController::StartScrollbarController // // Synopsis: Start a scroll bar controller if necessary. // // Arguments: pLayout layout object to be called on scroll changes // pDispScroller display scroller node // pServerHost server host // buttonWidth custom scroll bar button width // pMessage message that caused creation of controller // // Notes: // //---------------------------------------------------------------------------- void CScrollbarController::StartScrollbarController( CLayout* pLayout, CDispScroller* pDispScroller, CServer* pServerHost, long buttonWidth, CMessage* pMessage) { Assert(pLayout != NULL); Assert(pDispScroller != NULL); Assert(pServerHost != NULL); Assert(pMessage != NULL); BOOL fRightToLeft; CScrollbarController* pSBC = TLS(pSBC); Assert(pSBC != NULL); // just to make sure previous controller is stopped if(pSBC->_pLayout != NULL) { StopScrollbarController(); } pSBC->_direction = (pMessage->htc==HTC_HSCROLLBAR ? 0 : 1); pSBC->_pDispScroller = pDispScroller; pSBC->_drawInfo.Init(pLayout->ElementOwner()); fRightToLeft = (pSBC->_direction==0 && pDispScroller->IsRightToLeft()); // calculate scroll bar rect pDispScroller->GetClientRect( &pSBC->_rcScrollbar, (pSBC->_direction==0?CLIENTRECT_HSCROLLBAR:CLIENTRECT_VSCROLLBAR)); Assert(pSBC->_rcScrollbar.Contains(pMessage->ptContent)); LONG contentSize, containerSize, scrollAmount; pSBC->GetScrollInfo(&contentSize, &containerSize, &scrollAmount); // if the scrollbar is inactive, it doesn't matter what was pressed if(contentSize <= containerSize) { return; } // what was pressed? pSBC->_partPressed = GetPart( pSBC->_direction, pSBC->_rcScrollbar, pMessage->ptContent, contentSize, containerSize, scrollAmount, buttonWidth, pSBC->GetDrawInfo(), pDispScroller->IsRightToLeft()); Assert(pSBC->_partPressed != SBP_NONE); // if inactive track was pressed, no more work to do if(pSBC->_partPressed == SBP_TRACK) { return; } // make scroll bar controller active pSBC->_partPressedStart = pSBC->_partPressed; pSBC->_pLayout = pLayout; pSBC->_pDispScroller = pDispScroller; pSBC->_pServerHost = pServerHost; pSBC->_buttonWidth = buttonWidth; pSBC->_ptMouse = pMessage->ptContent; LONG lScrollTime = MAX_SCROLLTIME; // if thumbing, compute hit point offset from top of thumb if(pSBC->_partPressed == SBP_THUMB) { long trackSize = GetTrackSize( pSBC->_direction, pSBC->_rcScrollbar, pSBC->_buttonWidth); long thumbSize = GetThumbSize( pSBC->_direction, pSBC->_rcScrollbar, contentSize, containerSize, pSBC->_buttonWidth, pSBC->GetDrawInfo()); // _mouseInThumb is the xPos of the mouse in from the left edge of the thumb in LTR cases // and xPos of the mouse in from the right edge of the thumb in RTL HSCROLL cases if(!fRightToLeft) { pSBC->_mouseInThumb = pSBC->_ptMouse[pSBC->_direction] - pSBC->_rcScrollbar[pSBC->_direction] - GetScaledButtonWidth(pSBC->_direction, pSBC->_rcScrollbar, pSBC->_buttonWidth) - GetThumbOffset(contentSize, containerSize, scrollAmount, trackSize, thumbSize); } else { pSBC->_mouseInThumb = pSBC->_rcScrollbar.right - GetScaledButtonWidth(pSBC->_direction, pSBC->_rcScrollbar, pSBC->_buttonWidth) + GetThumbOffset(contentSize, containerSize, scrollAmount, trackSize, thumbSize) - pSBC->_ptMouse.x; } Assert(pSBC->_mouseInThumb >= 0); // no smooth scrolling lScrollTime = 0; } // capture the mouse HWND hwnd = pServerHost->_pInPlace->_hwnd; if(FAILED(GWSetCapture( pSBC, ONMESSAGE_METHOD(CScrollbarController, OnMessage, onmessage), hwnd))) { pSBC->_pLayout = NULL; return; } // set timer for repeating actions if(pSBC->_partPressed != SBP_THUMB) { // perform first action pLayout->OnScroll( pSBC->_direction, TranslateSBAction(pSBC->_partPressed), 0, FALSE, lScrollTime); CSize scrollOffset; pSBC->_pDispScroller->GetScrollOffset(&scrollOffset); scrollAmount = scrollOffset[pSBC->_direction]; // set timer for subsequent action FormsSetTimer( pSBC, ONTICK_METHOD(CScrollbarController, OnTick, ontick), SB_REPEAT_TIMER, GetRepeatDelay()); } // invalidate the part we hit, if necessary pLayout->OpenView(); InvalidatePart( pSBC->_partPressed, pSBC->_direction, pSBC->_rcScrollbar, contentSize, containerSize, scrollAmount, buttonWidth, pDispScroller, pSBC->GetDrawInfo()); }
//--------------------------------------------------------------------------------------------- void BachSearchBox::somethingChanged() { if ( !m_SSCB ) { DEBG( "Our callback is null, how?" ); return; } QString ss = m_SSCB->getSearchString(); QStringList ssparts; SmartTokenise( ss, ssparts ); QStringList parts; // DBG( ">>"+ss ); // for( int idx = 0 ; idx < ssparts.size() ; ++idx ) // DBG( ssparts[ idx ] ); // DBG( "<<<<<<<<<" ); //------------------------------------------ if ( ProjectBox->isChecked() ) { m_Proj_Parts.clear(); QString s ( "proj:"+Proj_Value->currentText() ); if ( s.contains( " " ) ) s = "\""+s+"\""; m_Proj_Parts << s; ReplacePart( "proj:", m_Proj_Parts[ 0 ], ssparts ); } else { EmptyParts( m_Proj_Parts, ssparts ); } //------------------------------------------ if ( FilePathBox->isChecked() ) { m_FP_Parts.clear(); QString s ( "file:"+FP_Value->text() ); if ( s.contains( " " ) ) s = "\""+s+"\""; m_FP_Parts << s; ReplacePart( "file:", m_FP_Parts[ 0 ], ssparts ); } else { EmptyParts( m_FP_Parts, ssparts ); } //------------------------------------------ if ( KeywordBox->isChecked() ) { m_KW_Parts.clear(); QString s ( "keyword:"+KW_Value->text() ); if ( s.contains( " " ) ) s = "\""+s+"\""; m_KW_Parts << s; ReplacePart( "keyword:", m_KW_Parts[ 0 ], ssparts ); } else { EmptyParts( m_KW_Parts, ssparts ); } //------------------------------------------ if ( !KW_Has_Value->isChecked() ) { m_HKW_Parts.clear(); m_HKW_Parts << "haskeyword:no"; ReplacePart( "haskeyword:no", m_HKW_Parts[ 0 ], ssparts ); } else { EmptyParts( m_HKW_Parts, ssparts ); } //------------------------------------------ if ( ExifBox->isChecked() ) { m_EI_Parts.clear(); QString s ( "exif:"+EI_Value->text() ); if ( s.contains( " " ) ) s = "\""+s+"\""; m_EI_Parts << s; ReplacePart( "exif:", m_EI_Parts[ 0 ], ssparts ); } else { EmptyParts( m_EI_Parts, ssparts ); } //------------------------------------------ GetPart( "from:", DateRangeBox, DR_Taken_From_CB, DR_Taken_From_Value, m_DR_Taken_From_Parts, ssparts ); GetPart( "to:", DateRangeBox, DR_Taken_To_CB, DR_Taken_To_Value, m_DR_Taken_To_Parts, ssparts ); GetPart( "from_import:", DateRangeBox, DR_Imported_From_CB, DR_Imported_From_Value, m_DR_Imported_From_Parts, ssparts ); GetPart( "to_import:", DateRangeBox, DR_Imported_To_CB, DR_Imported_To_Value, m_DR_Imported_To_Parts, ssparts ); //------------------------------------------ if ( CameraInfoBox->isChecked() ) { ReplacePart( "iso", GetPart< QDoubleSpinBox, double >( "iso", CI_ISO_Value, CI_ISO_OP, m_CI_Parts ), ssparts ); ReplacePart( "aperture", GetPart< QDoubleSpinBox, double >( "aperture", CI_Aperture_Value, CI_Aperture_OP, m_CI_Parts ), ssparts ); ReplacePart( "lens", GetPart< QDoubleSpinBox, double >( "lens", CI_Lens_Value, CI_Lens_OP, m_CI_Parts ), ssparts ); ReplacePart( "shutter", GetPart< QDoubleSpinBox, double >( "shutter", CI_Shutter_Value, CI_Shutter_OP, m_CI_Parts ), ssparts ); } else { EmptyParts( m_CI_Parts, ssparts ); } //------------------------------------------ if ( ImageDetailsBox->isChecked() ) { ReplacePart( "width", GetPart< QSpinBox, int >( "width", ID_Width_Value, ID_Width_OP, m_ID_Parts ), ssparts ); ReplacePart( "height", GetPart< QSpinBox, int >( "height", ID_Height_Value, ID_Height_OP, m_ID_Parts ), ssparts ); } else { EmptyParts( m_ID_Parts, ssparts ); } ss = ssparts.join( " " ); // DBG( "<<"+ss ); m_SSCB->setSearchString( ss ); }
IViewPart::Pointer ViewSite::GetViewPart() { return GetPart().Cast<IViewPart>(); }