Example #1
0
void _degrid2_thread(int *num_threads, int *cur_thread, Array<complex<T> > &data, Array<T> &coords, Array<complex<T> > &out, Array<T> &kernel_table)
{
    int imin, imax, jmin, jmax, i, j;
    int width = data.dimensions(0); // assume isotropic dims
    int width_div2 = width / 2;
    uint64_t p;
    T x, y, ix, jy;
    T kernelRadius = DEFAULT_RADIUS_FOV_PRODUCT / width;
    T kernelRadius_sqr = kernelRadius * kernelRadius;
    T width_inv = 1.0 / width;
    
    T dist_multiplier = (kernel_table.dimensions(0) - 1)/kernelRadius_sqr;
    
    /* split threads up by even chunks of data_out memory */
    unsigned long numSections = out.size() / *num_threads;
    unsigned long p_start = *cur_thread * numSections;
    unsigned long p_end = (*cur_thread+1) * numSections;
    
    /* loop over output data points */
    for (p=p_start; p<p_end; p++)
    {
        complex<T> d = 0.;
        
        /* get the coordinates of the datapoint to grid
         *  these vary between -.5 -- +.5               */
        x = coords.get1v(p, 0);
        y = coords.get1v(p, 1);
        
        /* set the boundaries of final dataset for gridding this point */
        ix = x * width + width_div2;
        set_minmax(ix, &imin, &imax, width, (T) DEFAULT_RADIUS_FOV_PRODUCT);
        jy = y * width + width_div2;
        set_minmax(jy, &jmin, &jmax, width, (T) DEFAULT_RADIUS_FOV_PRODUCT);
        
        /* Convolve the kernel at the coordinate location to get a
         * non-cartesian sample */
        for (j=jmin; j<=jmax; ++j)
        {
            jy = (j - width_div2) * width_inv;
            for (i=imin; i<=imax; ++i)
            {
                ix = (i - width_div2) * width_inv;
                T dist_sqr = dist2(ix - x, jy - y);
                if (dist_sqr < kernelRadius_sqr)
                {
                    T ker = get1(kernel_table, (int) rint(dist_sqr * dist_multiplier));
                    d += get2(data, i, j) * ker; // convolution sum
                }
            }
        }
        
        get1(out, p) = d; // store the sum for this coordinate point
    }
}
Example #2
0
static void 
set_minmax(graph_t * g)
{
    int c;

    GD_minrank(g) += ND_rank(GD_leader(g));
    GD_maxrank(g) += ND_rank(GD_leader(g));
    for (c = 1; c <= GD_n_cluster(g); c++)
	set_minmax(GD_clust(g)[c]);
}
Example #3
0
/* 
 * Assigns ranks of non-leader nodes.
 * Expands same, min, max rank sets.
 * Leaf sets and clusters remain merged.
 * Sets minrank and maxrank appropriately.
 */
static void expand_ranksets(graph_t * g, aspect_t* asp)
{
    int c;
    node_t *n, *leader;

    if ((n = agfstnode(g))) {
	GD_minrank(g) = MAXSHORT;
	GD_maxrank(g) = -1;
	while (n) {
	    leader = UF_find(n);
	    /* The following works because ND_rank(n) == 0 if n is not in a
	     * cluster, and ND_rank(n) = the local rank offset if n is in
	     * a cluster. */
	    if ((leader != n) && (!asp || (ND_rank(n) == 0)))
		ND_rank(n) += ND_rank(leader);

	    if (GD_maxrank(g) < ND_rank(n))
		GD_maxrank(g) = ND_rank(n);
	    if (GD_minrank(g) > ND_rank(n))
		GD_minrank(g) = ND_rank(n);

	    if (ND_ranktype(n) && (ND_ranktype(n) != LEAFSET))
		UF_singleton(n);
	    n = agnxtnode(g, n);
	}
	if (g == dot_root(g)) {
	    if (CL_type == LOCAL) {
		for (c = 1; c <= GD_n_cluster(g); c++)
		    set_minmax(GD_clust(g)[c]);
	    } else {
		find_clusters(g);
	    }
	}
    } else {
	GD_minrank(g) = GD_maxrank(g) = 0;
    }
}
Example #4
0
void _grid2_thread(int *num_threads, int *cur_thread, Array<complex<T> > &data, Array<T> &coords, Array<T> &weight, Array<complex<T> > &out, Array<T> &kernel_table, T dx, T dy)
{
    int imin, imax, jmin, jmax, i, j;
    int width = out.dimensions(0); // assume isotropic dims
    int width_div2 = width / 2;
    uint64_t arms = 1;
    uint64_t points_in_arm = 1;
    uint64_t arms_times_coils = 1;
    uint64_t coils = 1;
    uint64_t coil, arm, point;
    uint64_t width_times_coil = width;
    T x, y, ix, jy;
    T kernelRadius = DEFAULT_RADIUS_FOV_PRODUCT / width;
    T kernelRadius_sqr = kernelRadius * kernelRadius;
    T width_inv = 1.0 / width;
    
    T dist_multiplier = (kernel_table.dimensions(0) - 1)/kernelRadius_sqr;
    
    out = complex<T>(0.0);
    
    if (coords.ndim() == 3)
    {
        points_in_arm = coords.dimensions(1);
        arms = coords.dimensions(2);
    }
    
    if (out.ndim() == 3)
    {
        coils = out.dimensions(2);
    }
    arms_times_coils = arms * coils;
    width_times_coil = width * coils;
    
    /* split threads up by even chunks of data_out memory */
    uint64_t numSections = coils / *num_threads;
    uint64_t coil_start = *cur_thread * numSections;
    uint64_t coil_end = (*cur_thread+1) * numSections;
    
    /* loop over output data points */
    for (coil=coil_start; coil<coil_end; coil++)
    {
        for (arm=0; arm<arms; arm++)
        {
            for (point=0; point<points_in_arm; point++)
            {
                complex<T> d = data(point,arm,coil) * weight(point,arm);
                
                /* get the coordinates of the datapoint to grid
                 *  these vary between -.5 -- +.5               */
                x = coords(0,point,arm);
                y = coords(1,point,arm);
                
                /* add shift phase */
                d *= exp( complex<T>(0, -2.*M_PI*(x*dx+y*dy)) );
                
                /* set the boundaries of final dataset for gridding this point */
                ix = x * width + width_div2;
                set_minmax(ix, &imin, &imax, width, (T) DEFAULT_RADIUS_FOV_PRODUCT);
                jy = y * width + width_div2;
                set_minmax(jy, &jmin, &jmax, width, (T) DEFAULT_RADIUS_FOV_PRODUCT);
                
                /* grid this point onto the neighboring cartesian points */
                for (j=jmin; j<=jmax; ++j)
                {
                    jy = (j - width_div2) * width_inv;
                    for (i=imin; i<=imax; ++i)
                    {
                        ix = (i - width_div2) * width_inv;
                        T dist_sqr = dist2(ix - x, jy - y);
                        if (dist_sqr < kernelRadius_sqr)
                        {
                            T ker = get1(kernel_table, (int) rint(dist_sqr * dist_multiplier));
                            out(i,j,coil) += ker * d;
                        }
                    }// x
                }// y
            }//point in arms
        } //arms
    } //coil
}
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {

	HWND hw;
	int sel;
	DBVARIANT dbv;

	switch ( msg ) {
	case WM_INITDIALOG: {
		TranslateDialogDefault( hwndDlg );

		SendMessage(GetDlgItem(hwndDlg, IDC_SPIN1), UDM_SETRANGE, 0, (LPARAM)MAKELONG(50, 5));
		if(!DBGetContactSetting(NULL,"WorldTime","FontSize",&dbv)
			|| !DBGetContactSetting(NULL,"CLC","Font0Size",&dbv)) 
		{
			SendMessage(GetDlgItem(hwndDlg, IDC_SPIN1), UDM_SETPOS, 0, dbv.bVal);
		}

		SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 0));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_SETPOS, 0, DBGetContactSettingWord(NULL, "WorldTime", "Indent", 0));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETRANGE, 0, (LPARAM)MAKELONG(500, 6));
		SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_SETPOS, 0, DBGetContactSettingWord(NULL, "WorldTime", "RowHeight", GetSystemMetrics(SM_CYSMICON)));

		copy_listbox_items(temp_listbox_items, listbox_items);
		hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);

		for(int ili = 0; ili < temp_listbox_items.getCount(); ili++) {
			sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)&temp_listbox_items[ili].pszText);
		}

		if(!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
			bool minmax = (DBGetContactSettingByte(NULL, "WorldTime", "MinMax", DEFAULT_MINMAX ? 1 : 0) == 1);
			CheckDlgButton(hwndDlg, IDC_CHK_MINMAX, minmax);
			bool hide_menu = (DBGetContactSettingByte(NULL, "WorldTime", "HideMenu", 0) == 1);
			CheckDlgButton(hwndDlg, IDC_CHK_HIDEMENU, hide_menu ? 1 : 0);
		} else {
			CheckDlgButton(hwndDlg, IDC_CHK_HIDEMENU, TRUE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_HIDEMENU), FALSE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_SHOW), FALSE);
			EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_MINMAX), FALSE);
		}

		bool set_format = (DBGetContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", 0) == 1);
		CheckDlgButton(hwndDlg, IDC_CHK_FORMAT, set_format ? 1 : 0);
		bool show_icons = (DBGetContactSettingByte(NULL, "WorldTime", "ShowIcons", 1) == 1);
		CheckDlgButton(hwndDlg, IDC_CHK_ICONS, show_icons ? 1 : 0);
		DBVARIANT dbv;
		if(!DBGetContactSettingTString(NULL, "WorldTime", "TimeFormat", &dbv))
			_tcscpy(format_string, dbv.ptszVal);
		DBFreeVariant(&dbv);
		SetDlgItemText(hwndDlg, IDC_ED_FORMAT, format_string);
		if(!DBGetContactSettingTString(NULL, "WorldTime", "DateFormat", &dbv))
			_tcscpy(date_format_string, dbv.ptszVal);
		DBFreeVariant(&dbv);
		SetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, date_format_string);

		if(!set_format) {
			hw = GetDlgItem(hwndDlg, IDC_ED_FORMAT);
			EnableWindow(hw, FALSE);
			hw = GetDlgItem(hwndDlg, IDC_ED_DATE_FORMAT);
			EnableWindow(hw, FALSE);
		}

		SendDlgItemMessage(hwndDlg, IDC_TEXTCOL, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "WorldTime", "FontCol", GetSysColor(COLOR_WINDOWTEXT)));
		SendDlgItemMessage(hwndDlg, IDC_BGCOL, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, "WorldTime", "BgColour", GetSysColor(COLOR_3DFACE)));

		if(ServiceExists(MS_FONT_REGISTERT)) {
		    ShowWindow(GetDlgItem(hwndDlg, IDC_STATICH), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_STATICH2), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_SPIN1), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_ED_FSIZE), SW_HIDE);
		    ShowWindow(GetDlgItem(hwndDlg, IDC_TEXTCOL), SW_HIDE);

			ShowWindow(GetDlgItem(hwndDlg, IDC_STATFS), SW_SHOW);

		}

		//return TRUE;
		return FALSE;
	}
	case WM_COMMAND:
		if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) {
			switch( LOWORD( wParam )) {
			case IDC_ED_FORMAT:
			case IDC_ED_DATE_FORMAT:
				SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
			}	
		}

		if (HIWORD( wParam ) == LBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_TIMES2) {
			hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
			sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
			if(sel != LB_ERR) {
				hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
				EnableWindow(hw, sel != -1);
				hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
				EnableWindow(hw, sel != -1);

				hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
				EnableWindow(hw, (sel > 0));
				hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
				int count = SendMessage(hw, LB_GETCOUNT, 0, 0);
				hw = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
				EnableWindow(hw, (sel < count - 1));
			}
		}

		if ( HIWORD( wParam ) == BN_CLICKED ) {
			switch( LOWORD( wParam )) {
			case IDC_BTN_SHOW:
				ShowWindow(pluginwind, SW_SHOW);
				break;
			case IDC_BTN_EDIT:
				hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
				sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
				if(sel != LB_ERR && sel != -1) {

					add_edit_item = temp_listbox_items[sel];
					if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, DlgProcOpts2) == IDOK) {
						temp_listbox_items[sel] = add_edit_item;
						
						SendMessage(hw, LB_DELETESTRING, (WPARAM)sel, (LPARAM)0);
						SendMessage(hw, LB_INSERTSTRING, (WPARAM)sel, (LPARAM)add_edit_item.pszText);
						SendMessage(hw, LB_SETCURSEL, (WPARAM)sel, 0);

						SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
					}
				}
				break;

			case IDC_BTN_ADD:

				add_edit_item.pszText[0] = '\0';
				add_edit_item.timezone_list_index = -1;

				if(DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG2), hwndDlg, DlgProcOpts2) == IDOK) {
					temp_listbox_items.insert(new LISTITEM(add_edit_item));

					hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
					sel = SendMessage(hw, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)add_edit_item.pszText);
					SendMessage(hw, LB_SETCURSEL, (WPARAM)sel, 0);

					hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
					EnableWindow(hw, TRUE);
					hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
					EnableWindow(hw, TRUE);

					sel = temp_listbox_items.getCount() - 1;
					hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
					EnableWindow(hw, (sel > 0));
					hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
					int count = SendMessage(hw, LB_GETCOUNT, 0, 0);
					hw = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
					EnableWindow(hw, (sel < count - 1));

					SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				}
				break;

			case IDC_BTN_REM:
				hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
				sel = SendMessage(hw, LB_GETCURSEL, 0, 0);
				if(sel != LB_ERR) {
					SendMessage(hw, LB_DELETESTRING, (WPARAM)sel, 0);

					temp_listbox_items.remove(sel);

					hw = GetDlgItem(hwndDlg, IDC_BTN_REM);
					EnableWindow(hw, FALSE);
					hw = GetDlgItem(hwndDlg, IDC_BTN_EDIT);
					EnableWindow(hw, FALSE);
					hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
					EnableWindow(hw, FALSE);
					hw = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
					EnableWindow(hw, FALSE);
					SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				}
				break;
			case IDC_BTN_DOWN:
				{
					hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
					int sel2 = SendMessage(hw, LB_GETCURSEL, 0, 0);
					if(sel2 != LB_ERR) {
						add_edit_item = temp_listbox_items[sel2];					
						temp_listbox_items[sel2] = temp_listbox_items[sel2 + 1];					
						temp_listbox_items[sel2 + 1] = add_edit_item;

						SendMessage(hw, LB_DELETESTRING, (WPARAM)sel2, (LPARAM)0);
						SendMessage(hw, LB_INSERTSTRING, (WPARAM)sel2, (LPARAM)temp_listbox_items[sel2].pszText);
						SendMessage(hw, LB_DELETESTRING, (WPARAM)(sel2 + 1), (LPARAM)0);
						SendMessage(hw, LB_INSERTSTRING, (WPARAM)(sel2 + 1), (LPARAM)temp_listbox_items[sel2 + 1].pszText);
						SendMessage(hw, LB_SETCURSEL, (WPARAM)(sel2 + 1), 0);

						hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
						EnableWindow(hw, (sel2 + 1 > 0));
						hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
						int count = SendMessage(hw, LB_GETCOUNT, 0, 0);
						hw = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
						EnableWindow(hw, (sel2 + 1 < count - 1));

						SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
					}				
				}
				break;
			case IDC_BTN_UP:
				{
					hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
					int sel2 = SendMessage(hw, LB_GETCURSEL, 0, 0);
					if(sel2 != LB_ERR) {
						add_edit_item = temp_listbox_items[sel2];					
						temp_listbox_items[sel2] = temp_listbox_items[sel2 - 1];					
						temp_listbox_items[sel2 - 1] = add_edit_item;

						SendMessage(hw, LB_DELETESTRING, (WPARAM)sel2, (LPARAM)0);
						SendMessage(hw, LB_INSERTSTRING, (WPARAM)sel2, (LPARAM)temp_listbox_items[sel2].pszText);
						SendMessage(hw, LB_DELETESTRING, (WPARAM)(sel2 - 1), (LPARAM)0);
						SendMessage(hw, LB_INSERTSTRING, (WPARAM)(sel2 - 1), (LPARAM)temp_listbox_items[sel2 - 1].pszText);
						SendMessage(hw, LB_SETCURSEL, (WPARAM)(sel2 - 1), 0);

						hw = GetDlgItem(hwndDlg, IDC_BTN_UP);
						EnableWindow(hw, (sel2 - 1 > 0));
						hw = GetDlgItem(hwndDlg, IDC_LIST_TIMES2);
						int count = SendMessage(hw, LB_GETCOUNT, 0, 0);
						hw = GetDlgItem(hwndDlg, IDC_BTN_DOWN);
						EnableWindow(hw, (sel2 - 1 < count - 1));

						SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
					}				
				}
				break;
			case IDC_CHK_ICONS:
			case IDC_CHK_MINMAX:
				SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				break;
			case IDC_CHK_HIDEMENU:
				SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				break;
			case IDC_CHK_FORMAT:
				hw = GetDlgItem(hwndDlg, IDC_ED_FORMAT);
				EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_FORMAT));
				hw = GetDlgItem(hwndDlg, IDC_ED_DATE_FORMAT);
				EnableWindow(hw, IsDlgButtonChecked(hwndDlg, IDC_CHK_FORMAT));
				SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
				break;
			}
		}
		if(LOWORD(wParam) == IDC_TEXTCOL || LOWORD(wParam) == IDC_BGCOL
			|| LOWORD(wParam) == IDC_SPIN1 || LOWORD(wParam) == IDC_SP_INDENT || LOWORD(wParam) == IDC_SP_ROWHEIGHT)
		{
			SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
		}
		break;

	case WM_NOTIFY:
		if(((LPNMHDR)lParam)->code == UDN_DELTAPOS ) {
			SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
		}
		if(((LPNMHDR)lParam)->code == PSN_APPLY ) {
			bool new_minmax = IsDlgButtonChecked(hwndDlg, IDC_CHK_MINMAX) == BST_CHECKED;
			DBWriteContactSettingByte(NULL, "WorldTime", "MinMax", new_minmax ? 1 : 0);
			set_minmax(new_minmax);

			bool new_set_format = IsDlgButtonChecked(hwndDlg, IDC_CHK_FORMAT) == BST_CHECKED;
			DBWriteContactSettingByte(NULL, "WorldTime", "EnableTimeFormat", new_set_format ? 1 : 0);
			set_set_format(new_set_format);

			bool new_show_icons = IsDlgButtonChecked(hwndDlg, IDC_CHK_ICONS) == BST_CHECKED;
			DBWriteContactSettingByte(NULL, "WorldTime", "ShowIcons", new_show_icons ? 1 : 0);
			set_show_icons(new_show_icons);

			bool new_hide_menu = IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDEMENU) == BST_CHECKED;
			DBWriteContactSettingByte(NULL, "WorldTime", "HideMenu", new_hide_menu ? 1 : 0);
			set_hide_menu(new_hide_menu);

			TCHAR buf[512];
			GetDlgItemText(hwndDlg, IDC_ED_FORMAT, buf, 512);
			DBWriteContactSettingTString(NULL, "WorldTime", "TimeFormat", buf);
			set_time_format(buf);

			GetDlgItemText(hwndDlg, IDC_ED_DATE_FORMAT, buf, 512);
			DBWriteContactSettingTString(NULL, "WorldTime", "DateFormat", buf);
			set_date_format(buf);

			copy_listbox_items(listbox_items, temp_listbox_items);
			save_listbox_items();

			if(!ServiceExists(MS_FONT_REGISTERT)) {
				DBWriteContactSettingDword(NULL, "WorldTime", "FontCol", ContactFontColour = SendDlgItemMessage(hwndDlg, IDC_TEXTCOL, CPM_GETCOLOUR, 0, 0));
				DBWriteContactSettingByte(0, "WorldTime", "FontSize", (BYTE)SendMessage(GetDlgItem(hwndDlg, IDC_SPIN1), UDM_GETPOS, 0, 0) & 255);
			}

			DBWriteContactSettingDword(NULL, "WorldTime", "BgColour", SendDlgItemMessage(hwndDlg, IDC_BGCOL, CPM_GETCOLOUR, 0, 0));

			DBWriteContactSettingWord(0, "WorldTime", "Indent", (WORD)SendMessage(GetDlgItem(hwndDlg, IDC_SP_INDENT), UDM_GETPOS, 0, 0));
			DBWriteContactSettingWord(0, "WorldTime", "RowHeight", (WORD)SendMessage(GetDlgItem(hwndDlg, IDC_SP_ROWHEIGHT), UDM_GETPOS, 0, 0));

			DeleteObject(ContactFont);
			ContactFont = (HFONT)GetFont();

			if(pluginwind) {
				/*
				RECT r;
				SIZE textSize;
				GetWindowRect(pluginwind, &r);
				HFONT hOldFont = (HFONT)SelectObject(GetDC(pluginwind), ContactFont);
				GetTextExtentPoint32(GetDC(pluginwind),"X",1,&textSize);
				SelectObject(GetDC(pluginwind), hOldFont);
				SetWindowPos(pluginwind, 0, 0, 0, r.right - r.left, textSize.cy * listbox_items.size(), SWP_NOZORDER | SWP_NOMOVE);
				if(Frameid != -1) {
					CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, (WPARAM)MAKELONG(FO_HEIGHT, Frameid), (LPARAM)DBGetContactSettingByte(0, "WorldTime", "FontSize", 10) * listbox_items.size());
				}
				*/
				FillList(0, 0);				
			}

			return TRUE;
		}
		break;
	}

	return FALSE;
}
Example #6
0
 void clear_lines()
 {
   lines.clear();
   set_minmax();
 }
Example #7
0
/* Execute union commands for "same rank" subgraphs and clusters. */
static void 
collapse_sets(graph_t *rg, graph_t *g)
{
    int c;
    graph_t  *subg;
#ifdef OBSOLETE
    node_t *n;
#endif

#ifndef WITH_CGRAPH
    graph_t *mg;
    node_t *mn;
    edge_t *me;
    mg = g->meta_node->graph;
    for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
	mn = aghead(me);
	subg = agusergraph(mn);
#else /* WITH_CGRAPH */
    for (subg = agfstsubg(g); subg; subg = agnxtsubg(subg)) {
#endif /* WITH_CGRAPH */
	c = rank_set_class(subg);
	if (c) {
	    if ((c == CLUSTER) && CL_type == LOCAL)
		collapse_cluster(rg, subg);
	    else
		collapse_rankset(rg, subg, c);
	}
	else collapse_sets(rg, subg);

#ifdef OBSOLETE
 Collapsing leaves is currently obsolete

	/* mark nodes with ordered edges so their leaves are not collapsed */
	if (agget(subg, "ordering"))
	    for (n = agfstnode(subg); n; n = agnxtnode(subg, n))
		ND_order(n) = 1;
#endif
    }
}

static void 
find_clusters(graph_t * g)
{
    graph_t *subg;
#ifndef WITH_CGRAPH
    graph_t *mg;
    node_t *mn;
    edge_t *me;

    mg = g->meta_node->graph;
    for (me = agfstout(mg, g->meta_node); me; me = agnxtout(mg, me)) {
	mn = me->head;
	subg = agusergraph(mn);
#else /* WITH_CGRAPH */
    for (subg = agfstsubg(agroot(g)); subg; subg = agnxtsubg(subg)) {
#endif /* WITH_CGRAPH */
	if (GD_set_type(subg) == CLUSTER)
	    collapse_cluster(g, subg);
    }
}

static void 
set_minmax(graph_t * g)
{
    int c;

    GD_minrank(g) += ND_rank(GD_leader(g));
    GD_maxrank(g) += ND_rank(GD_leader(g));
    for (c = 1; c <= GD_n_cluster(g); c++)
	set_minmax(GD_clust(g)[c]);
}