public override string AST(int depth = 0) { return($"{Spaces(depth)}[{Name}\n" + $"{Id.AST(depth + 1)}" + $"{DeclarationBlock.AST(depth + 1)}" + $"{MainBlock.AST(depth + 1)}{Spaces(depth)}]\n"); }
private int _getNoOver() { MainBlock.Width = _width; MainBlock.Height = _height; MainBg.Background = Background; MainBlock.UpdateLayout(); if (!MainBlock.HasOverflowContent) { return(0); } PageItem block; for (int i = 0, length = _blocks.Count; i < length; i++) { block = _blocks[i]; block.SetSize(_width, _height); block.SetX((i + 1) + _width); block.Update(); if (!block.HasOver()) { return(i); } } return(-1); }
public bool Visit(MainBlock node) { foreach (var declarationsPart in node.DeclsParts) { declarationsPart.Accept(this); } foreach (var declarationsPart in node.DeclsParts) { if (!(declarationsPart is CallableDeclNode callableDecl) || !callableDecl.Header.CallableSymbol.IsForward) { continue; } foreach (var callable in _symStack.FindFunc(callableDecl.Header.Name.ToString())) { if (callable.IsForward) { throw new Exception(string.Format( "({0}, {1}) semantic error: forward declaration is not solved", callableDecl.Header.Name.Token.Line, callableDecl.Header.Name.Token.Column)); } } } node.MainCompound.Accept(this); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="NuGenToolTipInfoEditorUI"/> class. /// </summary> /// <param name="serviceContext"></param> /// <param name="serviceProvider"> /// <para>Requires:</para> /// <para><see cref="INuGenToolTipLayoutManager"/></para> /// <para><see cref="INuGenToolTipRenderer"/></para> /// </param> /// <param name="initialTooltipInfo"></param> /// <exception cref="ArgumentNullException"> /// <para> /// <paramref name="serviceProvider"/> is <see langword="null"/>. /// </para> /// -or- /// <para> /// <paramref name="serviceContext"/> is <see langword="null"/>. /// </para> /// </exception> public NuGenToolTipInfoEditorUI( INuGenServiceProvider serviceProvider, NuGenToolTipInfo initialTooltipInfo, NuGenCustomTypeEditorServiceContext serviceContext ) { if (serviceProvider == null) { throw new ArgumentNullException("serviceProvider"); } if (serviceContext == null) { throw new ArgumentNullException("serviceContext"); } _serviceProvider = serviceProvider; this.SuspendLayout(); _mainBlock = new MainBlock(serviceContext); _mainBlock.Parent = this; _remarksBlock = new RemarksBlock(serviceContext); _remarksBlock.Height = 100; _remarksBlock.Parent = this; _okButton = new Button(); _okButton.DialogResult = DialogResult.OK; _okButton.TabIndex = 0; _okButton.Text = Resources.Text_ToolTipInfoEditor_okButton; _cancelButton = new Button(); _cancelButton.DialogResult = DialogResult.Cancel; _cancelButton.TabIndex = 1; _cancelButton.Text = Resources.Text_ToolTipInfoEditor_cancelButton; _sizeBlock = new SizeBlock(); _sizeBlock.Parent = this; _dialogLayoutPanel = new DialogFlowLayoutPanel(); _dialogLayoutPanel.Controls.Add(_cancelButton); _dialogLayoutPanel.Controls.Add(_okButton); _dialogLayoutPanel.Parent = this; this.CancelButton = _cancelButton; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Padding = new Padding(3); this.ShowIcon = false; this.ShowInTaskbar = false; this.Size = new Size(350, 400); this.StartPosition = FormStartPosition.CenterParent; this.Text = Resources.Text_ToolTipInfoEditor_EditorForm; this.SetStateFromTooltipInfo(initialTooltipInfo); this.ResumeLayout(false); }
/// <summary> /// Creates all the MainBlocks for the puzzle based on all the PreDefinedCells. /// </summary> public void CreateMainBlocks() { for (int i = 0; i < _puzzleData.PreDefinedCells.Count; i++) { IMainBlock mainBlock = new MainBlock(_puzzleData.PreDefinedCells[i].Value, _solutionTracker.Grid.GetCellFromCoordinates(_puzzleData.PreDefinedCells[i].Coordinates), i); _solutionTracker.Grid.MainBlocks.Add(mainBlock); } }
private void ConfiguringRelativePositions() { MainBlock mainBlock = new MainBlock(); MainBlockViewModel mainBlockViewModel = (MainBlockViewModel)mainBlock.DataContext; mainBlockViewModel.CommonData = _commonParams.GetCommonData(); mainBlockViewModel.ICommonData = _commonParams; _relativePositions.SetRelativePositions(mainBlock); }
private void LoadRelativePositions() { MainBlock mainBLC = new MainBlock(); if (_mainBlockViewModel != null) { mainBLC = _mainBlock; } //_mainBlock = new MainBlock(); if (_mainBlockViewModel.BaseDrawElements.Count == 0) { _mainBlockViewModel = (MainBlockViewModel)_mainBlock.DataContext; } else { _mainBlock = mainBLC; _mainBlockViewModel = (MainBlockViewModel)mainBLC.DataContext; } _mainBlockOwnNeed = new MainBlock(); _mainBlockViewModelOwnNeed = (MainBlockViewModel)_mainBlockOwnNeed.DataContext; // _mainBlockViewModel.ListAllFraemEl = new ObservableCollection<FrameworkElement>(); // _mainBlockViewModel.ListElem = new List<BaseDrawClass>(); //if (frm.Count > 0) //{ // int count = 0; // foreach (var var in frm) // { // _mainBlockViewModel.ListAllFraemEl.Add(frm[count]); // count++; // } // count = 0; // foreach (var var in bdc) // { // bdc[count].MyWindow = _mainBlockViewModel; // _mainBlockViewModel.ListElem.Add(bdc[count]); // count++; // } //} _mainBlockViewModel.CommonData = _commonData; _mainBlockViewModel.IToastNotifications = this; _mainBlockViewModel.ICommonData = this; _mainBlockViewModel.EditMaket = delegate(CommonData cd, PVMCell at, int width, int height) { EditMak(cd, at, width, height); }; _mainBlockViewModel.FileLoad = delegate(Handler h, string p) { return(LoadFile(h, p)); }; _mainBlockViewModel.ShowTemplateLibrary = ShowTemplateLibrary; _mainBlockViewModel.SaveNullCells = delegate(AreaType at, List <BaseDrawClass> pl) { CreateCellNull(at, pl); }; }
public AstPrinterNode Visit(MainBlock node) { var printer = new AstPrinterNode(node.ToString()); foreach (var nodeDeclsPart in node.DeclsParts) { printer.AddChild(nodeDeclsPart.Accept(this)); } printer.AddChild(node.MainCompound.Accept(this)); return(printer); }
private void CreateSettings() { _controller.Creators.SettingsCreator.Create(); _controller.SaveSettings(); if (_mainBlock == null) { _mainBlock = new MainBlock(_controller); } if (_controller.Settings != null) { _mainBlock.OnEnable(); } }
private void OnEnable() { if (_controller == null) { _controller = new ABManagerController(); } if (_mainBlock == null) { _mainBlock = new MainBlock(_controller); } if (_controller.Settings != null) { _mainBlock.OnEnable(); } }
/// <summary> /// Links the given module /// </summary> /// <param name="context"></param> /// <returns></returns> public void Link(LinkContext context) { // save parameters this.context = context; // find the "main" block MainBlock main = context.Main; if (main == null) { throw new CompileException(Error.NoMain); } // let main compile itself in the global context main.Compile(context); }
/// <summary> /// Turn a DBData type into a MainBlock. Fills properties of each cell within the block. /// </summary> /// <param name="data"></param> /// <returns></returns> private MainBlock CreateBlockFromSavedData(DBData data) { Cell defCell = Grid.Cells[data.DefCell_XPos, data.DefCell_YPos]; MainBlock block = new MainBlock(data.Block_id, data.Area, defCell, Grid); for (int i = data.TopLeft_XPos; i < data.X_Dimension + data.TopLeft_XPos; i++) { for (int j = data.TopLeft_YPos; j < data.Y_Dimension + data.TopLeft_YPos; j++) { Cell cell = Grid.Cells[i, j]; cell.OwnedBy = data.Block_id; block.CertainCells.Add(cell); block.TopLeftCell = defCell; } } return(block); }
/// <summary> /// The information in the List<TextBox> representing the GUI, is converted to the backend data. /// Creates a main block foreach Textbox that contains a value. Sets the Blocks Index, Area and DefinedCell /// </summary> /// <param name="textBoxes"></param> public void ReadGUIInput(List <TextBox> textBoxes) { int blockIndex = 0; for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { int textBoxIndex = 7 * i + j; TextBox txtbox = textBoxes[textBoxIndex]; Cell cell = Grid.Cells[i, j]; if (txtbox.Text != "") { int blockArea; blockArea = int.Parse(txtbox.Text); MainBlock MBlock = new MainBlock(blockIndex++, blockArea, cell, Grid); Grid.Blocks.Add(MBlock); cell.SetOwnership(MBlock); PredefinedCells.Add(textBoxIndex, blockArea); } } } }