methodofwasmodify.java

来自「一个简单的visio程序。」· Java 代码 · 共 1,557 行 · 第 1/4 页

JAVA
1,557
字号
        if((value - (int)value) == 0) 
			INNvalue = new Integer((int)value);
        String msg = "'height' property is read-only";
		MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.OK, 1);
		PropTextbox pt = (PropTextbox)propertysheet.getPropPanel().views[i];
		ChangeText(pt,INNvalue,i,propertysheet);

	}

	private static void rightSize(int i,float value,String name,short smode,int tag,Wrapper wrapp) 
	{
        PropSheet propertysheet = MainConsole.getpropertySheet();
        if (smode == 0)
		{
            if(tag == 0)
			{
                value = propertysheet.conScale(name,value,0);
            }
			else if(tag == 1)
			{
                value = propertysheet.conScale(name,value,1);
            }
        }
		else
		{
            value = Util.convertJavaScale(smode,value);
        }
        if(!(name.equalsIgnoreCase("defcolwidth")||name.equalsIgnoreCase("rowheight")))
        if((1-(value - (int)value))<0.001 && smode == 1)
		{
            value = (int)value + 1;
        }
		else if((value - (int)value)<0.01 && smode == 1)
		{
            value = (int)value;
        }
        //setFrameLabel((float)value,name,wrapp);
        if((value - (int)value) == 0)
		{
			PropTextbox pt = (PropTextbox)propertysheet.getPropPanel().views[i];
            ChangeText(pt,new Integer((int)value),i,propertysheet);
        }
		else
		{
			PropTextbox pt = (PropTextbox)propertysheet.getPropPanel().views[i];
            ChangeText(pt,new Float(value),i,propertysheet);
        }
    }

	private static Object LimitedFormSize(int i,float value,String name,Wrapper wrapp)
	{
		PropSheet propertysheet = MainConsole.getpropertySheet();
        
        if(name.equalsIgnoreCase("height"))
		{
            if(value < 405)
			    value = 405;
            else if(value > 9180)
			    value = 9180;            
        }
		else if(name.equalsIgnoreCase("width"))
		{
            if(value < 1680)
			    value = 1680;
            else if(value > 12180)
                value = 12180;            
        }
		else if(name.equalsIgnoreCase("top"))
		{
            if(value > 243579)
                value = 243579;
            else if(value < -245760)
                value = -245760;
        }else if(name.equalsIgnoreCase("left"))
		{
            if(value > 245745)
                value = 245745;
            else if(value < -245760)
                value = -245760;
        }
        //setFrameLabel((float)value,name,wrapp);
        if((value - (int)value) == 0)
		{
            PropTextbox pt = (PropTextbox)propertysheet.getPropPanel().views[i];
            ChangeText(pt,new Integer((int)value),i,propertysheet);
        }
		else
		{
            PropTextbox pt = (PropTextbox)propertysheet.getPropPanel().views[i];
            ChangeText(pt,new Float(value),i,propertysheet);
        }
        return(new Float(value));
    }

	private static Object convalue(Object value,Wrapper wrapp)
	{
        if(value instanceof Double)
		{
            double Ivalue = (((Double)value).doubleValue())*15;
            if((Ivalue - (int)Ivalue) > 0.5){
                Ivalue = Ivalue +1;
            }
            return new Integer((int)Ivalue);
        }
		else if (value instanceof Integer) 
		{
            return new Integer(((Number)value).intValue()*15);
        }
		else
		{
            float Ivalue = (Util.getFloatValue(value))*15;
            if((Ivalue - (int)Ivalue) > 0.5)
			{
                Ivalue = Ivalue +1;
            }
            return new Integer((int)(Ivalue));
        }
    }

	public static void convertscale(int value,int tag,Wrapper wrapp)
	{
        if(tag == 0)
		{
            Object scaleheight  = null;
            Object scalewidth   = null;
            float    Iscaleheight = 5940;
            float    Iscalewidth  = 6690;

            Object scaleht = wrapp.getPropValue("height");
            float fscaleht = Util.getFloatValue(scaleht);
            fscaleht = fscaleht - 4;

            Object scalewh = wrapp.getPropValue("width");
            float fscalewh = Util.getFloatValue(scalewh);
            fscalewh = fscalewh - 4;
            Controlslist control = wrapp.getControl();

            Iscaleheight = Util.convertJavaScale(value,fscaleht);
            scaleheight = new Float(Iscaleheight);
            try
			{
                wrapp.setPropValue("scaleheight",scaleheight);
            }
			catch(Exception e){ }
            control.prop.put("scaleheight",scaleheight);

            Iscalewidth  = Util.convertJavaScale(value,fscalewh);
            scalewidth = new Float(Iscalewidth);
            try
			{
                wrapp.setPropValue("scalewidth",scalewidth);
            }
			catch(Exception e)
			{
				//  System.out.println("Exception PropertySheet_2539::::"+e);
            }
            control.prop.put("scalewidth",scalewidth);

            control.prop.put("scaleleft",new Float(0));
            try
			{
                wrapp.setPropValue("scaleleft",new Float(0));
            }
			catch(Exception e)
			{	
				// System.out.println("Exception PropertySheet_2548::::"+e);
            }
            wrapp.getFrame().prop.put("scaletop",new Float(0));
            try
			{
                wrapp.setPropValue("scaletop",new Float(0));
            }
			catch(Exception e)
			{
				// System.out.println("Exception PropertySheet_2556::::"+e);
            }
        }
		else if(tag == 1)
		{
            Object scaleheight  = null;
            Object scalewidth   = null;
            float    Iscaleheight = 5940;
            float    Iscalewidth  = 6690;

            Object scaleht = wrapp.getFrame().prop.get("height");
            float fscaleht = Util.getFloatValue(scaleht);
            fscaleht = (fscaleht/15) - 27;
			/*
            if(wrapp.getFrame().mlist != null && wrapp.getFrame().mlist.length>0)
			{
				fscaleht = fscaleht - (wrapp.getFrame().getInsets().top - wrapp.getFrame().TOP);
            }
			*/

            Object scalewh = wrapp.getFrame().prop.get("width");
            float fscalewh = Util.getFloatValue(scalewh);
            fscalewh = (fscalewh/15) - 8;

            Iscaleheight = Util.convertJavaScale(value,fscaleht);
			try
			{
				wrapp.getFrame().setScaleHeight(Iscaleheight);
			}
			catch(Exception e)
			{
			}
            scaleheight = new Float(Iscaleheight);
            wrapp.getFrame().prop.put("scaleheight",scaleheight);

            Iscalewidth  = Util.convertJavaScale(value,fscalewh);
			try
			{
				wrapp.getFrame().setScaleWidth(Iscalewidth);
			}
			catch(Exception e)
			{
			}
            scalewidth = new Float(Iscalewidth);
            wrapp.getFrame().prop.put("scalewidth",scalewidth);

            wrapp.getFrame().prop.put("scaleleft",new Float(0));
            wrapp.getFrame().setScaleLeft(0);
            wrapp.getFrame().prop.put("scaletop",new Float(0));
            wrapp.getFrame().setScaleTop(0);
        }
    }

    private static Object IndexName1(String name,Object Invalue,int i,Wrapper wrap, PropSheet propsheet) 
	{
		int		id;
        int     b        = 0;
        short   yh       = 0;
        short   Index    = 0;
        short   Index1   = 0;
        String  ctr      = null;
        String  ctrlname = null;
		PropPanel    proppanel = propsheet.getPropPanel();
        Controlslist control   = wrap.getControl();
        MainConsole  mM        = MainConsole.getMainConsole();
        for (int cn = 0; cn < wrap.getFrame().clist.size(); cn++)
		{
            Controlslist contrl = (Controlslist)(wrap.getFrame().clist.elementAt(cn));
            if ((Wrapper)contrl.wrap != wrap) 
			{
                Index = -1;
                Object ind = contrl.prop.get("index");
                if (ind != null) 
				{                
					Index = ((Number)ind).shortValue();
                }
				ctrlname = (String)(contrl.prop.get("name"));
				ctr      =   contrl.className;
            }
            if (((String)Invalue).equalsIgnoreCase(ctrlname)
            && (control.prop.get("index")) == null
            && (ctr.equalsIgnoreCase(control.className)))
			{               
				if (Index != -1) 
				{                  
					for (int cm = 0; cm<wrap.getFrame().clist.size(); cm++) 
					{                  
						Controlslist ctrl = (Controlslist)(wrap.getFrame().clist.elementAt(cm));
						String name1 = (String)(ctrl.prop.get("name"));
						if (name1.equalsIgnoreCase(ctrlname)) 
						{
							Index = ((Number)(ctrl.prop.get("index"))).shortValue();
							if (Index > yh) 
							{
								yh = Index;
							} 
						} 
					} 
					for (short j = 0; j < (yh+2); j++)
					{
						b = 0;
						for (int co = 0; co < wrap.getFrame().clist.size(); co++)
						{ 
							Controlslist ctr1 = (Controlslist)(wrap.getFrame().clist.elementAt(co));
							if (((String)(ctr1.prop.get("name"))).equalsIgnoreCase(ctrlname))
							{
								Index = ((Number)(ctr1.prop.get("index"))).shortValue();
								if ((Index - j) == 0)
								{
									b = 1;
								} 
							} 
						}
						if (b != 1)
						{
							Index1 = j;
							break;
						} 
					}				
					Object oldIndex = control.prop.get("index");
					Wrapper wrap1 = (Wrapper)control.wrap;
					try
					{
						wrap1.setPropValue("index",new Short(Index1));
					}
					catch(Exception e) { }
					control.prop.put("index",new Short(Index1));
					propsheet.setProperty("index",(int)Index1);
				} 
			    else
				{ 
					String nam = (String)Invalue;
    				String msg = "You already have a control named " + "'" + nam +"'" + ". \nDo you want to create a control array";

					id = MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.YES+MsgBox.NO, 1);
					if(id == MsgBox.YES)
					{					
						Object oldIndex1 = control.prop.get("index");
						Wrapper wrap1 = (Wrapper)control.wrap;
						try
						{
							wrap1.setPropValue("index",new Short((short)(Index+2)));
						}
						catch (Exception e) { }
                    
						control.prop.put("index",new Short((short)(Index+2)));
						propsheet.setProperty("index", Index+2);
						wrap1 = (Wrapper)contrl.wrap;
						try
						{	 					
							wrap1.setPropValue("index",new Short((short)(Index+1)) );
						}
						catch(Exception e) { }
						contrl.prop.put("index",new Short((short)(Index+1)) );
						propsheet.canRefresh = true;
                    }
					else
					{                    
						Invalue = control.prop.get("name");
						PropTextbox st = (PropTextbox)proppanel.views[i];
						ChangeText(st,Invalue,i,propsheet);
                    }
				} 
                break;
            }
			else if (((String)Invalue).equalsIgnoreCase(ctrlname) && (control.prop.get("index") != null) 
			 &&((((Number)(control.prop.get("index"))).shortValue()) != -1)
             &&(ctr.equalsIgnoreCase(control.className)))
			{            
				if (Index != -1)
				{                
					for (int cr = 0; cr < wrap.getFrame().clist.size(); cr++)
					{                    
						Controlslist ctr2 = (Controlslist)(wrap.getFrame().clist.elementAt(cr));                        
						if ((Wrapper)ctr2.wrap != wrap)
						{                        
							if (((String)(ctr2.prop.get("name"))).equalsIgnoreCase(ctrlname))
							{                            
								Index = ((Number)(ctr2.prop.get("index"))).shortValue();                                  
								if (Index == ((Number)(control.prop.get("index"))).shortValue())
								{
    	     	                     String msg = "Array already has control index " + "'" + Index +"'";
									 MsgBox.MessageBox(new Frame(), "Instant Basic",msg, MsgBox.OK, 1);
                                     Invalue = control.prop.get("name");
                                     PropTextbox st = (PropTextbox)proppanel.views[i];
                                     ChangeText(st,Invalue,i,propsheet);
                                     break;
								} 
							} 
						} 
					} 
				}
				else
				{                      
					if (((Number)(control.prop.get("index"))).shortValue() == 0)
					{                         
						Wrapper wrap1 = (Wrapper)contrl.wrap;                       
						try
						{                         
							wrap1.setPropValue("index",new Short((short)(Index+2)) );
						}
						catch(Exception e) {  }
                        contrl.prop.put("index",new Short((short)(Index+2)) );
					}
					else
					{
                         Wrapper wrap1 = (Wrapper)contrl.wrap;
                         try
						 {
							wrap1.setPropValue("index",new Short((short)(Index+1)) );
                         }
						 catch (Exception e) {  }
                         contrl.prop.put("index",new Short((short)(Index+1)) );
					} 
				}
                break;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?