int SetPathBoxProc (HWND hDlg, int message, WPARAM wParam, LPARAM lParam) { switch (message) { case MSG_INITDIALOG: { char cwd [MAX_PATH + 1]; SetNotificationCallback (GetDlgItem (hDlg, IDL_DIR), dir_notif_proc); // SetNotificationCallback (GetDlgItem (hDlg, IDL_FILE), file_notif_proc); SetNotificationCallback (GetDlgItem (hDlg, IDC_CHAR), char_notif_proc); fill_boxes (hDlg, getcwd (cwd, MAX_PATH)); return 1; } case MSG_COMMAND: switch (wParam) { case IDOK: prompt (hDlg); if(!opendir(cd)) mkdir(cd,0111); case IDCANCEL: EndDialog (hDlg, wParam); break; } break; } return DefaultDialogProc (hDlg, message, wParam, lParam); }
static void dir_notif_proc (HWND hwnd, int id, int nc, DWORD add_data) { if(nc==LBN_SETFOCUS&&opendir(cd)) fill_boxes (GetParent (hwnd), cd); if (nc == LBN_DBLCLK || nc == LBN_ENTER) { int cur_sel = SendMessage (hwnd, LB_GETCURSEL, 0, 0L); if (cur_sel >= 0) { char cwd [MAX_PATH + 1]; char dir [MAX_NAME + 1]; GetWindowText (GetDlgItem (GetParent (hwnd), IDC_PATH), cwd, MAX_PATH); SendMessage (hwnd, LB_GETTEXT, cur_sel, (LPARAM)dir); if (strcmp (dir, ".") == 0) return; if (strcmp (dir, "..") == 0) { char* slash; if (strcmp (cwd, "/") == 0) return; slash = strrchr (cwd, '/'); if (slash == NULL) return; if (slash == cwd) strcpy (cwd, "/"); else *slash = '\0'; } else { if (strcmp (cwd, "/") != 0) strcat (cwd, "/"); strcat (cwd, dir); } strcpy(cd,cwd); SetWindowText(GetDlgItem (GetParent (hwnd), IDC_CHAR),cd); fill_boxes (GetParent (hwnd), cwd); } } }
static cairo_status_t draw_boxes (cairo_composite_rectangles_t *composite, cairo_boxes_t *boxes) { cairo_win32_display_surface_t *dst = to_win32_display_surface(composite->surface); cairo_operator_t op = composite->op; const cairo_pattern_t *src = &composite->source_pattern.base; cairo_int_status_t status; TRACE ((stderr, "%s\n", __FUNCTION__)); if (boxes->num_boxes == 0 && composite->is_bounded) return CAIRO_STATUS_SUCCESS; if (!boxes->is_pixel_aligned) return CAIRO_STATUS_SUCCESS; //return CAIRO_INT_STATUS_UNSUPPORTED; if (op == CAIRO_OPERATOR_CLEAR) op = CAIRO_OPERATOR_SOURCE; if (op == CAIRO_OPERATOR_OVER && _cairo_pattern_is_opaque (src, &composite->bounded)) op = CAIRO_OPERATOR_SOURCE; if (dst->win32.base.is_clear && (op == CAIRO_OPERATOR_OVER || op == CAIRO_OPERATOR_ADD)) op = CAIRO_OPERATOR_SOURCE; if (op == CAIRO_OPERATOR_SOURCE) { status = CAIRO_INT_STATUS_UNSUPPORTED; if (src->type == CAIRO_PATTERN_TYPE_SURFACE) { status = copy_boxes (dst, src, boxes); if (status == CAIRO_INT_STATUS_UNSUPPORTED) status = upload_boxes (dst, src, boxes); } else if (src->type == CAIRO_PATTERN_TYPE_SOLID) { status = fill_boxes (dst, src, boxes); } return status; } if (op == CAIRO_OPERATOR_OVER && can_alpha_blend (dst)) return alpha_blend_boxes (dst, src, boxes, 255); return CAIRO_INT_STATUS_UNSUPPORTED; }
/* Init of boxSearch struct. x: time series (scaled between 0 and 1) m, d: embedding dimension and time delay blength: total number of points in the embedding space eps: neighborhood size */ boxSearch init_boxSearch(double *x, int m, int d, int blength, double eps){ boxSearch res; int i; res.series = x; res.m = m; res.d = d; res.blength = blength; res.eps = eps; res.jpntr = (int*) R_alloc(blength, sizeof(int)); res.jh = (int**) R_alloc(BOX, sizeof(int*)); for(i=0; i<BOX; i++) res.jh[i] = (int*) R_alloc(BOX, sizeof(int)); fill_boxes(x, m, d, blength, eps, res.jh, res.jpntr); return res; }
/******************************************************************************* * File Name: ziyuanguanliqi.c * Copy Right: GaoHaibo * Author: GaoHaibo * Function discription:處理路徑 *******************************************************************************/ static void dir_notif_proc (HWND hcwd, int id, int nc, DWORD add_data) { if (nc == LBN_CLICKED || nc == LBN_ENTER) { int cur_sel = SendMessage(hcwd, LB_GETCURSEL, 0, 0L); if (cur_sel >= 0) { char cwd [MAX_PATH + 1]; char dir [MAX_NAME + 1]; GetWindowText(GetDlgItem(GetParent(hcwd), IDC_XZ_PATH), cwd, MAX_PATH); SendMessage(hcwd, LB_GETTEXT, cur_sel, (LPARAM)dir); if (strcmp(dir, ".") == 0) { return; } strcat(cwd, "/"); strcat(cwd, dir); fill_boxes(GetParent(hcwd), cwd); } } }
/* ************************************************************************* * * computeFillBoxesAndNeighborhoodSets * ************************************************************************* */ void PatchLevelEnhancedFillPattern::computeFillBoxesAndNeighborhoodSets( boost::shared_ptr<hier::BoxLevel>& fill_box_level, boost::shared_ptr<hier::Connector>& dst_to_fill, const hier::BoxLevel& dst_box_level, const hier::IntVector& fill_ghost_width, bool data_on_patch_border) { NULL_USE(data_on_patch_border); TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); fill_box_level.reset(new hier::BoxLevel( dst_box_level.getRefinementRatio(), dst_box_level.getGridGeometry(), dst_box_level.getMPI())); dst_to_fill.reset(new hier::Connector(dst_box_level, *fill_box_level, fill_ghost_width)); boost::shared_ptr<const hier::BaseGridGeometry> grid_geometry( dst_box_level.getGridGeometry()); const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); hier::LocalId last_id = dst_box_level.getLastLocalId(); for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); ni != dst_boxes.realEnd(); ++ni) { const hier::Box& dst_box = *ni; const hier::BoxId& dst_box_id = dst_box.getBoxId(); hier::BoxContainer fill_boxes( hier::Box::grow(dst_box, fill_ghost_width)); hier::BoxContainer constructed_fill_boxes; hier::Connector::NeighborhoodIterator base_box_itr = dst_to_fill->findLocal(dst_box_id); bool has_base_box = base_box_itr != dst_to_fill->end(); for (hier::BaseGridGeometry::ConstNeighborIterator ni = grid_geometry->begin(dst_box.getBlockId()); ni != grid_geometry->end(dst_box.getBlockId()); ++ni) { const hier::BaseGridGeometry::Neighbor& nbr = *ni; if (nbr.isSingularity()) { hier::BoxContainer encon_boxes(nbr.getTransformedDomain()); encon_boxes.refine(dst_box_level.getRefinementRatio()); encon_boxes.intersectBoxes(fill_boxes); encon_boxes.removeIntersections(constructed_fill_boxes); if (encon_boxes.size()) { if (!has_base_box) { base_box_itr = dst_to_fill->makeEmptyLocalNeighborhood( dst_box_id); has_base_box = true; } for (hier::BoxContainer::iterator ei = encon_boxes.begin(); ei != encon_boxes.end(); ++ei) { hier::Box fill_box( *ei, ++last_id, dst_box.getOwnerRank()); TBOX_ASSERT(fill_box.getBlockId() == dst_box.getBlockId()); fill_box_level->addBoxWithoutUpdate(fill_box); dst_to_fill->insertLocalNeighbor( fill_box, base_box_itr); constructed_fill_boxes.pushBack(*ei); } } } } d_max_fill_boxes = tbox::MathUtilities<int>::Max( d_max_fill_boxes, constructed_fill_boxes.size()); } fill_box_level->finalize(); }
static int ZiYuanguanliqiProc(HWND hcwd, int message, WPARAM wParam, LPARAM lParam) { { switch (message) { case MSG_CREATE: { char cwd [MAX_PATH + 1]; loadbk(hcwd); #if 1 CreateWindow(CTRL_STATIC, MSG_TARGET_DIR, WS_VISIBLE | SS_SIMPLE, IDC_STATIC, 10, 2, 120, 25, hcwd, 0); hFile = CreateWindow(CTRL_LISTBOX, "", WS_VISIBLE | WS_VSCROLL | WS_BORDER | LBS_SORT | LBS_AUTOCHECKBOX, IDC_XZ_FILE, 10, 20, 280, 140, hcwd, 0); #else CreateWindow(CTRL_STATIC, "Directory List Box", WS_VISIBLE | SS_SIMPLE, IDC_STATIC, 10, 2, 120, 25, hcwd, 0); hDir = CreateWindow(CTRL_LISTBOX, "", WS_VISIBLE | WS_VSCROLL | WS_BORDER | LBS_SORT | LBS_NOTIFY, IDC_XZ_DIR, 10, 20, 140, 140, hcwd, 0); CreateWindow(CTRL_STATIC, "File List Box", WS_VISIBLE | SS_SIMPLE, IDC_STATIC, 165, 2, 120, 25, hcwd, 0); hFile = CreateWindow(CTRL_LISTBOX, "", WS_VISIBLE | WS_VSCROLL | WS_BORDER | LBS_SORT | LBS_AUTOCHECKBOX, IDC_XZ_FILE, 165, 20, 140, 140, hcwd, 0); hPath = CreateWindow(CTRL_STATIC, MSG_PATH, WS_VISIBLE | SS_SIMPLE, IDC_XZ_PATH, 10, 150, 315, 0, hcwd, 0); #endif CreateWindow (CTRL_BUTTON, MSG_DELECT, WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP, IDC_XZ_DELETE, 15, 165, 130, 25, hcwd, 0); // CreateWindow // (CTRL_BUTTON, MSG_VIEW, WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP | WS_GROUP, IDC_XZ_VIEW, 15, 185, 130, 25, hcwd, 0); CreateWindow (CTRL_BUTTON, MSG_RETURN, WS_VISIBLE | BS_PUSHBUTTON | WS_TABSTOP, IDC_XZ_RETURN, 170, 165, 130, 25, hcwd, 0); SetNotificationCallback(hFile, file_notif_proc); SetNotificationCallback(hDir, dir_notif_proc); //fill_boxes(hcwd, getcwd(cwd, MAX_PATH)); fill_boxes(hcwd, MSG_TARGET_DIR); } break; case MSG_CLOSE: { DestroyMainWindow(hcwd); PostQuitMessage(hcwd); } return 0; case MSG_COMMAND: { switch (wParam) { case IDC_XZ_DELETE: /*刪除指定文件*/ DeleteFile(hcwd); break; //case IDC_XZ_VIEW: // View(hcwd); case IDC_XZ_RETURN: /*返回主界面*/ DestroyMainWindow(hcwd); PostQuitMessage(hcwd); break; } } return 0; } return DefaultMainWinProc(hcwd, message, wParam, lParam); } }
/* ************************************************************************* * * computeFillBoxesAndNeighborhoodSets * ************************************************************************* */ void PatchLevelBorderFillPattern::computeFillBoxesAndNeighborhoodSets( boost::shared_ptr<hier::BoxLevel>& fill_box_level, boost::shared_ptr<hier::Connector>& dst_to_fill, const hier::BoxLevel& dst_box_level, const hier::IntVector& fill_ghost_width, bool data_on_patch_border) { TBOX_ASSERT_OBJDIM_EQUALITY2(dst_box_level, fill_ghost_width); fill_box_level.reset(new hier::BoxLevel( dst_box_level.getRefinementRatio(), dst_box_level.getGridGeometry(), dst_box_level.getMPI())); dst_to_fill.reset(new hier::Connector(dst_box_level, *fill_box_level, fill_ghost_width)); const hier::BoxContainer& dst_boxes = dst_box_level.getBoxes(); const int dst_level_num = dst_box_level.getGridGeometry()-> getEquivalentLevelNumber(dst_box_level.getRefinementRatio()); hier::IntVector dst_to_dst_width(fill_ghost_width); if (data_on_patch_border) { dst_to_dst_width += hier::IntVector::getOne(fill_ghost_width.getDim()); } const hier::Connector& dst_to_dst = dst_box_level.findConnector(dst_box_level, dst_to_dst_width, hier::CONNECTOR_IMPLICIT_CREATION_RULE, true); /* * To get the level border, grow each patch box and remove * the level from it. */ hier::LocalId last_id = dst_box_level.getLastLocalId(); for (hier::RealBoxConstIterator ni(dst_boxes.realBegin()); ni != dst_boxes.realEnd(); ++ni) { const hier::Box& dst_box = *ni; hier::BoxContainer fill_boxes( hier::Box::grow(dst_box, fill_ghost_width)); hier::Connector::ConstNeighborhoodIterator nabrs = dst_to_dst.find(dst_box.getBoxId()); for (hier::Connector::ConstNeighborIterator na = dst_to_dst.begin(nabrs); na != dst_to_dst.end(nabrs); ++na) { if (dst_box.getBlockId() == na->getBlockId()) { fill_boxes.removeIntersections(*na); } else { boost::shared_ptr<const hier::BaseGridGeometry> grid_geometry( dst_box_level.getGridGeometry()); const hier::BlockId& dst_block_id = dst_box.getBlockId(); const hier::BlockId& nbr_block_id = na->getBlockId(); TBOX_ASSERT(grid_geometry->areNeighbors(dst_block_id, nbr_block_id)); hier::Transformation::RotationIdentifier rotation = grid_geometry->getRotationIdentifier(dst_block_id, nbr_block_id); hier::IntVector offset( grid_geometry->getOffset(dst_block_id, nbr_block_id, dst_level_num)); hier::Transformation transformation(rotation, offset, nbr_block_id, dst_block_id); hier::Box nbr_box(*na); transformation.transform(nbr_box); fill_boxes.removeIntersections(nbr_box); } } if (!fill_boxes.empty()) { d_max_fill_boxes = tbox::MathUtilities<int>::Max(d_max_fill_boxes, fill_boxes.size()); hier::Connector::NeighborhoodIterator base_box_itr = dst_to_fill->makeEmptyLocalNeighborhood(dst_box.getBoxId()); for (hier::BoxContainer::iterator li = fill_boxes.begin(); li != fill_boxes.end(); ++li) { hier::Box fill_box(*li, ++last_id, dst_box.getOwnerRank()); TBOX_ASSERT(fill_box.getBlockId() == dst_box.getBlockId()); fill_box_level->addBoxWithoutUpdate(fill_box); dst_to_fill->insertLocalNeighbor(fill_box, base_box_itr); } } } fill_box_level->finalize(); }
static int Desktop(HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { char cwd[MAX_PATH + 1]; //DEB("-Desktop: \n "); switch (message) { case MSG_CREATE: { DEB("--MSG_CREATE\n "); /* CreateWindow(CTRL_LISTBOX, "", LBS_NOTIFY | WS_VSCROLL | WS_BORDER | WS_VISIBLE, IDC_FUN_3G_NOW_LISTBOX_FILE, 10, 30, 100, 100, hWnd, 0); */ CreateWindow(CTRL_LISTBOX, "", LBS_NOTIFY | WS_VSCROLL | WS_BORDER | WS_VISIBLE, IDC_FUN_3G_NOW_LISTBOX_FILE, 10, 30, 100, 100, hWnd, 0); CreateWindow(CTRL_LISTBOX, "", LBS_NOTIFY | WS_VSCROLL | WS_BORDER | WS_VISIBLE, IDC_FUN_3G_ADD_LISTBOX_FILE, 110, 30, 100, 100, hWnd, 0); CreateWindow(CTRL_STATIC, MSG_PATH, WS_VISIBLE | SS_SIMPLE, IDC_FUN_MPLAYER_MUSICADD_STATIC_PATH, 10, 10, 130, 15, hWnd, 0); CreateWindow(CTRL_BUTTON, MSG_DOWNLOAD, WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_FUN_MPLAYER_MUSICADD_BUTTON_CHOOSE, 230, 50, 70, 25, hWnd, 0); CreateWindow(CTRL_BUTTON, MSG_CANCEL, WS_TABSTOP | WS_VISIBLE | BS_DEFPUSHBUTTON, IDC_FUN_MPLAYER_MUSICADD_BUTTON_CANCEL, 230, 100, 50, 25, hWnd, 0); SetNotificationCallback(GetDlgItem(hWnd, IDC_FUN_3G_NOW_LISTBOX_FILE), now_notif_proc); SetNotificationCallback(GetDlgItem(hWnd, IDC_FUN_3G_ADD_LISTBOX_FILE), file_notif_proc); fill_boxes(hWnd, getcwd(cwd, MAX_PATH)); } break; case MSG_COMMAND: { DEB("--MSG_COMMAND hWnd=%d\n ,hWnd"); switch (wParam) { case IDC_FUN_MPLAYER_MUSICADD_BUTTON_CHOOSE: DEB("---IDC_FUN_MPLAYER_MUSICADD_BUTTON_CHOOSE\n "); fn_3gFileSave(hWnd); DEB("---SendNotifyMessage fWnd=%d\n ",fWnd); SendNotifyMessage(fWnd, MSG_MUSIC_ADD, 0, 0L); DEB("---SendNotifyMessage end\n "); break; case IDC_FUN_MPLAYER_MUSICADD_BUTTON_CANCEL: DEB("---IDC_FUN_MPLAYER_MUSICADD_BUTTON_CANCEL\n "); DestroyMainWindow(hWnd); PostQuitMessage(hWnd); return 0; } DEB("--MSG_COMMAND END\n "); } break; case MSG_CLOSE: { DEB("--MSG_CLOSE\n "); DestroyMainWindow(hWnd); PostQuitMessage(hWnd); return 0; } } return DefaultMainWinProc(hWnd, message, wParam, lParam); }